act.io.read_arm_netcdf

act.io.read_arm_netcdf(filenames, concat_dim=None, return_None=False, combine='by_coords', decode_times=True, use_cftime=True, use_base_time=False, combine_attrs='override', cleanup_qc=False, keep_variables=None, **kwargs)[source]

Returns xarray.Dataset with stored data and metadata from a user-defined query of ARM-standard netCDF files from a single datastream. Has some procedures to ensure time is correctly fomatted in returned Dataset.

Parameters:
  • filenames (str, pathlib.PosixPath, list of str, list of pathlib.PosixPath) – Name of file(s) to read.

  • concat_dim (str) – Dimension to concatenate files along.

  • return_None (boolean) – Catch IOError exception when file not found and return None. Default is False.

  • combine (str) – String used by xarray.open_mfdataset() to determine how to combine data files into one Dataset. See Xarray documentation for options.

  • decode_times (boolean) – Standard Xarray option to decode time values from int/float to python datetime values. Appears the default is to do this anyway but need this option to allow correct usage of use_base_time.

  • use_cftime (boolean) – Option to use cftime library to parse the time units string and correctly establish the time values with a units string containing timezone offset. This is used because the Pandas units string parser does not correctly recognize time zone offset. Code will automatically detect cftime object and convert to datetime64 in returned Dataset.

  • use_base_time (boolean) – Option to use ARM time variables base_time and time_offset. Useful when the time variable is not included (older files) or when the units attribute is incorrectly formatted. Will use the values of base_time and time_offset as seconds since epoch and create datetime64 values for time coordinate. If set will change decode_times and use_cftime to False.

  • combine_attrs (str) – String indicating how to combine attrs of the datasets being merged

  • cleanup_qc (boolean) – Call clean.cleanup() method to convert to standardized ancillary quality control variables. This will not allow any keyword options, so if non-default behavior is desired will need to call clean.cleanup() method on the dataset after reading the data.

  • keep_variables (str or list of str) – Variable names to read from data file. Works by creating a list of variable names to exclude from reading and passing into open_mfdataset() via drop_variables keyword. Still allows use of drop_variables keyword for variables not listed in first file to read.

  • **kwargs (keywords) – Keywords to pass through to xarray.open_mfdataset().

Returns:

ds (xarray.Dataset (or None)) – ACT Xarray dataset (or None if no data file(s) found).

Examples

This example will load the example sounding data used for unit testing.

import act
ds = act.io.arm.read_arm_netcdf(act.tests.sample_files.EXAMPLE_SONDE_WILDCARD)
print(ds)