cmaqsatproc.readers package¶
Subpackages¶
Submodules¶
cmaqsatproc.readers.core module¶
- class cmaqsatproc.readers.core.satellite[source]¶
Bases:
object
- classmethod add_weights(intx, option='equal')[source]¶
Add Weights to intersection dataframe (intx) using predefined options: * ‘equal’ uses equal weights for all overlapping pixels * ‘area’ uses area of intersection for all overlapping pixels * other methods can be added by overriding this mehtod
- Parameters:
intx (geopandas.GeoDataFrame) – Dataframe that has a geometry field that supports area
- Return type:
None
- classmethod cmr_links(method='opendap', **kwds)[source]¶
Use utils.getcmrlinks to get links from the NASA Common Metadata Repo
- Parameters:
method (str) – Options are opendap, download, or s3
kwds (mappable) – Passed through to utils.getcmrlinks. See getcmrlinks for valid keywords
- Returns:
links – List of links to OpenDAP, http downloadable, or s3 links
- Return type:
list
- classmethod cmr_to_level3(temporal, grid, griddims=None, weighting='area', bbox=None, verbose=0, varkeys=None, as_dataset=True, link_kwargs=None, **kwargs)[source]¶
Wrapper around cmr_links and paths_to_level3. For description of keywords, see those methods.
- property ds¶
- classmethod from_dataset(ds, path='unknown')[source]¶
Create a satellite object from a dataset
- Parameters:
ds (xarray.Dataset) – Satellite dataset
- Returns:
sat – Satellite processing instance
- Return type:
- classmethod open_dataset(path, bbox=None, **kwargs)[source]¶
Create a satellite object from the dataset at a path. The path can be a local path or a remote path (OpenDAP or s3).
- Parameters:
path (str) – Path to a satellite file
bbox (iterable) – swlon, swlat, nelon, nelat in decimal degrees East and North of 0, 0
kwargs (mappable) – Passed to xarray.open_dataset
- Returns:
sat – Satellite processing instance
- Return type:
- classmethod paths_to_level3(paths, grid, griddims=None, weighting='area', bbox=None, verbose=0, varkeys=None, as_dataset=True, **kwargs)[source]¶
Iteratively apply output = cls(path).to_level3(*args, path=path, **kwds) and then grouped_weighted_avg(output[dims]) for each dimset.
For description of keywords, see to_level3.
- shorten_name(k)[source]¶
By default, nothing is done and k is returned. Override this method to make short names that are suitable for other purposes (e.g., IOAPI 16 character names)
- to_dataframe(*varkeys, valid=True, geo=False, default_keys=False)[source]¶
Transform the Dataset into a dataframe. This function is similar to xr.Dataset.to_dataframe, but includes geopandas support and filtering for valid pixels.
- Parameters:
varkeys (iterable) – Keys to use in the dataframe. Defaults to class._defaultkeys that is class specific
valid (bool) – If true, only return valid pixels.
geo (bool) – Add geometry to output a geopandas.GeoDataFrame
- Returns:
df
- Return type:
pandas.DataFrame or geopandas.GeoDataFrame
- to_level3(*varkeys, grid, griddims=None, weighting='area', as_dataset=True, verbose=0)[source]¶
Convert variables from L2 file to a custom L3 file.
- Parameters:
varkeys (iterable) – See to_dataframe
grid (geopandas.GeoDataFrame) – Defines the grid used as the L3 destination
griddims (iterable) – Defaults to grid.index.names
weighting (str) – Passed as option to self.add_weights
- Returns:
outputs – Dictionary of outputs by output dimensions or Dataset of outputs as a dataset
- Return type:
dict or xr.Dataset
Module contents¶
- class cmaqsatproc.readers.satellite[source]¶
Bases:
object
- classmethod add_weights(intx, option='equal')[source]¶
Add Weights to intersection dataframe (intx) using predefined options: * ‘equal’ uses equal weights for all overlapping pixels * ‘area’ uses area of intersection for all overlapping pixels * other methods can be added by overriding this mehtod
- Parameters:
intx (geopandas.GeoDataFrame) – Dataframe that has a geometry field that supports area
- Return type:
None
- classmethod cmr_links(method='opendap', **kwds)[source]¶
Use utils.getcmrlinks to get links from the NASA Common Metadata Repo
- Parameters:
method (str) – Options are opendap, download, or s3
kwds (mappable) – Passed through to utils.getcmrlinks. See getcmrlinks for valid keywords
- Returns:
links – List of links to OpenDAP, http downloadable, or s3 links
- Return type:
list
- classmethod cmr_to_level3(temporal, grid, griddims=None, weighting='area', bbox=None, verbose=0, varkeys=None, as_dataset=True, link_kwargs=None, **kwargs)[source]¶
Wrapper around cmr_links and paths_to_level3. For description of keywords, see those methods.
- property ds¶
- classmethod from_dataset(ds, path='unknown')[source]¶
Create a satellite object from a dataset
- Parameters:
ds (xarray.Dataset) – Satellite dataset
- Returns:
sat – Satellite processing instance
- Return type:
- classmethod open_dataset(path, bbox=None, **kwargs)[source]¶
Create a satellite object from the dataset at a path. The path can be a local path or a remote path (OpenDAP or s3).
- Parameters:
path (str) – Path to a satellite file
bbox (iterable) – swlon, swlat, nelon, nelat in decimal degrees East and North of 0, 0
kwargs (mappable) – Passed to xarray.open_dataset
- Returns:
sat – Satellite processing instance
- Return type:
- classmethod paths_to_level3(paths, grid, griddims=None, weighting='area', bbox=None, verbose=0, varkeys=None, as_dataset=True, **kwargs)[source]¶
Iteratively apply output = cls(path).to_level3(*args, path=path, **kwds) and then grouped_weighted_avg(output[dims]) for each dimset.
For description of keywords, see to_level3.
- shorten_name(k)[source]¶
By default, nothing is done and k is returned. Override this method to make short names that are suitable for other purposes (e.g., IOAPI 16 character names)
- to_dataframe(*varkeys, valid=True, geo=False, default_keys=False)[source]¶
Transform the Dataset into a dataframe. This function is similar to xr.Dataset.to_dataframe, but includes geopandas support and filtering for valid pixels.
- Parameters:
varkeys (iterable) – Keys to use in the dataframe. Defaults to class._defaultkeys that is class specific
valid (bool) – If true, only return valid pixels.
geo (bool) – Add geometry to output a geopandas.GeoDataFrame
- Returns:
df
- Return type:
pandas.DataFrame or geopandas.GeoDataFrame
- to_level3(*varkeys, grid, griddims=None, weighting='area', as_dataset=True, verbose=0)[source]¶
Convert variables from L2 file to a custom L3 file.
- Parameters:
varkeys (iterable) – See to_dataframe
grid (geopandas.GeoDataFrame) – Defines the grid used as the L3 destination
griddims (iterable) – Defaults to grid.index.names
weighting (str) – Passed as option to self.add_weights
- Returns:
outputs – Dictionary of outputs by output dimensions or Dataset of outputs as a dataset
- Return type:
dict or xr.Dataset