dataretrieval.nadp
Tools for retrieving data from the National Atmospheric Deposition Program (NADP), including the National Trends Network (NTN) and the Mercury Deposition Network (MDN).
National Trends Network
The NTN provides long-term records of precipitation chemistry across the United States. See https://nadp.slh.wisc.edu/ntn for more info.
Mercury Deposition Network
The MDN provides long-term records of total mercury (Hg) concentration and deposition in precipitation in the United States and Canada. For more information visit https://nadp.slh.wisc.edu/networks/mercury-deposition-network/
Notes
Gridded data on NADP is served as zipped tif files. Functions in this module will either download and extract the data, when a path is specified, or open the data as a GDAL memory-mapped file when no path is specified.
Todo
include AIRMoN, AMNet, and AMoN
flexible handling of strings for parameters and measurement types
add errorchecking
add tests
- class dataretrieval.nadp.NADP_ZipFile(file, mode='r', compression=0, allowZip64=True, compresslevel=None, *, strict_timestamps=True, metadata_encoding=None)[source]
Extend zipfile.ZipFile for working on data from NADP
- dataretrieval.nadp.get_annual_MDN_map(measurement_type: str, year: str, path: str) str[source]
Download an MDN map from NADP.
This function looks for a zip file containing gridded information at: https://nadp.slh.wisc.edu/maps-data/mdn-gradient-maps/. The function will download the zip file and extract it, exposing the tif file if a path is provided.
- Parameters:
measurement_type (string) – The type of measurement (concentration or deposition) as a string, either ‘conc’ or ‘dep’ respectively.
year (string) – Year as a string ‘YYYY’
path (string) – Download directory.
- Returns:
path – Path that zip file was extracted into if path was specified.
- Return type:
string
Examples
>>> # get map of mercury concentration in 2010 and extract it to a path >>> data_path = dataretrieval.nadp.get_annual_MDN_map( ... measurement_type="conc", year="2010", path="somepath" ... )
- dataretrieval.nadp.get_annual_NTN_map(measurement_type: str, measurement: str | None = None, year: str | None = None, path: str = '.') str[source]
Download an NTN map from NADP.
This function looks for a zip file containing gridded information at: https://nadp.slh.wisc.edu/maps-data/ntn-gradient-maps/. The function will download the zip file and extract it, exposing the tif file at the provided path.
Note
Measurement type abbreviations for concentration and deposition are all lower-case, but for precipitation data, the first letter must be capitalized!
- Parameters:
measurement_type (string) – The type of measurement, ‘conc’, ‘dep’, or ‘Precip’, which represent concentration, deposition, or precipitation respectively.
measurement (string) – The measured constituent to return.
year (string) – Year as a string ‘YYYY’
path (string) – Download directory, defaults to current directory if not specified.
- Returns:
path – Path that zip file was extracted into if path was specified.
- Return type:
string
Examples
>>> # get a map of precipitation in 2015 and extract it to a path >>> data_path = dataretrieval.nadp.get_annual_NTN_map( ... measurement_type="Precip", year="2015", path="somepath" ... )
- dataretrieval.nadp.get_zip(url: str, filename: str) NADP_ZipFile[source]
Gets a ZipFile at url and returns it
- Parameters:
url (string) – URL to zip file
filename (string) – Name of zip file
- Returns:
ZipFile
.. todo:: – finish docstring