pynldas2.pynldas2#
Get hourly NLDAS2 forcing data.
Module Contents#
- pynldas2.pynldas2.get_bycoords(coords, start_date, end_date, coords_id=None, crs=4326, variables=None, to_xarray=False, snow=False, snow_params=None, conn_timeout=1000, validate_filesize=True)#
Get NLDAS-2 climate forcing data for a list of coordinates.
- Parameters:
coords (
list
oftuples
) – List of (lon, lat) coordinates.start_date (
str
) – Start date of the data.end_date (
str
) – End date of the data.crs (
str
,int
, orpyproj.CRS
, optional) – The CRS of the input coordinates, defaults toEPSG:4326
.variables (
str
orlist
ofstr
, optional) – Variables to download. If None, all variables are downloaded. Valid variables are:prcp
,pet
,temp
,wind_u
,wind_v
,rlds
,rsds
, andhumidity
andpsurf
.to_xarray (
bool
, optional) – If True, the data is returned as an xarray dataset.snow (
bool
, optional) – Compute snowfall from precipitation and temperature. Defaults toFalse
.snow_params (
dict
, optional) – Model-specific parameters as a dictionary that is passed to the snowfall function. These parameters are only used ifsnow
isTrue
. Two parameters are required:t_rain
(deg C) which is the threshold for temperature for considering rain andt_snow
(deg C) which is the threshold for temperature for considering snow. The default values are{'t_rain': 2.5, 't_snow': 0.6}
that are adopted from https://doi.org/10.5194/gmd-11-1077-2018.conn_timeout (
int
, optional) – Connection timeout in seconds, defaults to 1000.validate_filesize (
bool
, optional) – When set toTrue
, the function checks the file size of the previously cached files and will re-download if the local filesize does not match that of the remote. Defaults toTrue
. Setting this toFalse
can be useful when you are sure that the cached files are not corrupted and just want to get the combined dataset more quickly. This is faster because it avoids web requests that are necessary for getting the file sizes.
- Returns:
pandas.DataFrame
– The requested data as a dataframe.- Return type:
- pynldas2.pynldas2.get_bygeom(geometry, start_date, end_date, geo_crs=4326, variables=None, snow=False, snow_params=None, conn_timeout=1000, validate_filesize=True)#
Get hourly NLDAS-2 climate forcing within a geometry at 0.125 resolution.
- Parameters:
geometry (
Polygon
ortuple
) – The geometry of the region of interest. It can be a shapely Polygon or a tuple of length 4 representing the bounding box (minx, miny, maxx, maxy).start_date (
str
) – Start date of the data.end_date (
str
) – End date of the data.geo_crs (
int
,str
, orpyproj.CRS
) – CRS of the input geometryvariables (
str
orlist
ofstr
, optional) – Variables to download. If None, all variables are downloaded. Valid variables are:prcp
,pet
,temp
,wind_u
,wind_v
,rlds
,rsds
, andhumidity
andpsurf
.snow (
bool
, optional) – Compute snowfall from precipitation and temperature. Defaults toFalse
.snow_params (
dict
, optional) – Model-specific parameters as a dictionary that is passed to the snowfall function. These parameters are only used ifsnow
isTrue
. Two parameters are required:t_rain
(deg C) which is the threshold for temperature for considering rain andt_snow
(deg C) which is the threshold for temperature for considering snow. The default values are{'t_rain': 2.5, 't_snow': 0.6}
that are adopted from https://doi.org/10.5194/gmd-11-1077-2018.conn_timeout (
int
, optional) – Connection timeout in seconds, defaults to 1000.validate_filesize (
bool
, optional) – When set toTrue
, the function checks the file size of the previously cached files and will re-download if the local filesize does not match that of the remote. Defaults toTrue
. Setting this toFalse
can be useful when you are sure that the cached files are not corrupted and just want to get the combined dataset more quickly. This is faster because it avoids web requests that are necessary for getting the file sizes.
- Returns:
xarray.Dataset
– The requested forcing data.- Return type: