eoio.readers.generic_netcdf.reader module#

eoio.readers.generic_netcdf.reader#

Reader for arbitrary netCDF files.

This is the fallback for any .nc file that no product-specific reader recognises, including files written by eoio.write().

Attributes are always decoded with eoio.serialisation.decode_attrs(), so values eoio encoded on write (datetimes, nested dicts, geometries) come back as Python objects. Files eoio did not write are decoded on a best-effort basis: strings holding a JSON object or array, or an ISO-8601 datetime, are converted and everything else is left as it is.

Classes#

NetCDFReader(path[, vars_sel, subset, ...])

Reader for generic netCDF files.

class eoio.readers.generic_netcdf.reader.NetCDFReader(path, vars_sel=None, subset=None, read_params=None)[source]#

Bases: BaseReader

Reader for generic netCDF files.

Every variable in the file is offered as a measurement variable. No subsetting parameters are accepted, since an arbitrary file cannot be assumed to follow eoio’s coordinate naming.

Readers for specific netCDF products (HYPERNETS, EMIT, ECMWF) subclass this for the source dataset it opens, self.ds_src, but override open_dataset(), so the attribute decoding done there applies to this reader only.

static get_extension() → str[source]#

Return file extension for extracted files for this product.

Returns:

File extension as string.

open_dataset() → Dataset[source]#

Open the netCDF file as an xarray.Dataset according to the request parameters.

Returns:

The opened dataset, with attributes decoded.