FAAM_Dataset

The FAAM_Dataset class handles the core_faam*nc files and smoothes out the reading process of the data and ensures that older files are read in the same way as newer ones. The class copies the behaviour of netCDF4.Dataset class.

A nifty method of the class is the merge method, which allows you to merge data from other data sources. The data type that can be merged is a numpy.recarray. The index for the procedure is the timestamp, of the FAAM_Dataset. Care is taken off gaps in the recarray.

A convenient option is exporting the Dataset into a pandas DataFrame, which then gives you all the amazing features of pandas. Due to the fact that pandas can not deal with multidimensional arrays, only the first measurement within a row is used for the DataFrame.

class faampy.core.faam_data.FAAM_Dataset(filename)[source]

Dataset class which has much in common with the netCDF4.Dataset. The class has methods that helps to perform common tasks like merging and can copy

as_dataframe(varnames=[])[source]

Returns the Dataset as a pandas.Dataframe using the timestamp as index, which opens the world of pandas to you. Only the first column of two dimensional data sets is grabbed, because pandas does not handle multidimensional data very well.

Parameters:varnames (list) – list of variable names that should be exported as DataFrame. By default all are exported
Returns:returns a pandas Dataframe with the Timestamp as index
as_kml(extrude=1, tessellate=1)[source]

Returns a kml linestring which represents the flight track of the current dataset

Parameters:
  • extrude (boolean) – whether the linestring is extruded
  • tessellate (boolean) – whether the linestring is tesselated
Returns:

kml string

close()[source]

Closing dataset

merge(recarray, index='', varnames=[], delay=0)[source]

Merges in a numpy recarray with the FAAM_Dataset using concurring timestamps

Parameters:
  • recarray (numpy.recarray) – A numpy numpy.recarray with named data
  • index (str) – Name of the column/field that contains the timestamp. Note that the merging only works on timestamps. The maximum time resolution is 1sec.
  • varnames (list of strings) – List of varnames from the input array that should be merged
  • delay (int) – instruments have a time offset compared to the core data. For example the FGGA is aboute four seconds slower than the core temperature measurements. The delay keyword takes this care of this and shifts the data.
write(outfilename, v_name_list=[], as_1Hz=True, clobber=False)[source]

Writing dataset out as NetCDF

Parameters:
  • outfilename (str) – path for the new NetCDF
  • v_name_list (list) – list of variables names that should be written. By default all variables are added to the NetCDF
  • as_1Hz (boolean) – Writes only 1Hz data out. If the variable is avaiable in higher frequency only the first value within the second is used rather than the average from the number of data points
  • clobber (boolean) – Overwrites the files if it exists