The gridmet_tools Module
- get_atmos_url(year: int, variable='PM25') str [source]
Constructs URL to download data from the Atmospheric Composition Analysis Group given a year and a band
- get_nkn_url(variable: str, year: int) str [source]
Constructs URL to download data from University of Idaho (UI) Northwest Knowledge Network given a year and a band
- check_shape_file(shapes_dir: str, year: int, geography_type: str, shape_type: str) [typing.Optional[str], <class 'list'>] [source]
- find_shape_file(shapes_dir: str, year: int, geography_type: str, shape_type: str) str [source]
Finds shapefile for a given type of geographies for the closest available year
- Parameters:
- Returns:
a shape file for a given year if it exists or for the latest year before the given
- get_variable(dataset: Dataset, variable: str)[source]
Extracts a variable (column) name by a variable “standard name” from NCDF4 dataset
Standard name is a name of a band as described here: https://gee.stac.cloud/WUtw2spmec7AM9rk6xMXUtStkMtbviDtHK?t=bands
A column name is a name of the column in the dataset
- get_days(dataset: Dataset) List [source]
Extracts a table fo days from NCDF4 dataset
- Parameters:
dataset¶ – NCDF4 dataset
- Returns:
List, containing days
- get_affine_transform(nc_file: str, factor: int = 1)[source]
Returns affine transformation for a NCDF4 dataset.
Uses rasterio package: https://rasterio.readthedocs.io/en/latest/index.html
The Affine object is a named tuple with elements a, b, c, d, e, f corresponding to the elements in the matrix equation below, in which a pixel’s image coordinates are x, y and its world coordinates are x’, y’
See more: https://rasterio.readthedocs.io/en/latest/topics/georeferencing.html
- disaggregate(layer, factor: int)[source]
Implementation of R disaggregate function with method == ‘’.
See details: https://www.rdocumentation.org/packages/raster/versions/3.4-5/topics/disaggregate
or, original source code:
https://github.com/r-forge/raster/blob/master/pkg/raster/R/disaggregate.R