pydaymet.pydaymet

Access the Daymet database for both single single pixel and gridded queries.

Module Contents

pydaymet.pydaymet.get_bycoords(coords, dates, crs=DEF_CRS, variables=None, region='na', time_scale='daily', pet=None, pet_params=None, ssl=None, expire_after=EXPIRE, disable_caching=False)

Get point-data from the Daymet database at 1-km resolution.

This function uses THREDDS data service to get the coordinates and supports getting monthly and annual summaries of the climate data directly from the server.

Parameters
  • coords (tuple) – Coordinates of the location of interest as a tuple (lon, lat)

  • dates (tuple or list, optional) – Start and end dates as a tuple (start, end) or a list of years [2001, 2010, ...].

  • crs (str, optional) – The CRS of the input geometry, defaults to "epsg:4326".

  • variables (str or list) – List of variables to be downloaded. The acceptable variables are: tmin, tmax, prcp, srad, vp, swe, dayl Descriptions can be found here.

  • region (str, optional) – Target region in the US, defaults to na. Acceptable values are:

    • na: Continental North America

    • hi: Hawaii

    • pr: Puerto Rico

  • time_scale (str, optional) – Data time scale which can be daily, monthly (monthly summaries), or annual (annual summaries). Defaults to daily.

  • pet (str, optional) – Method for computing PET. Supported methods are penman_monteith, priestley_taylor, hargreaves_samani, and None (don’t compute PET). The penman_monteith method is based on Allen et al.1 assuming that soil heat flux density is zero. The priestley_taylor method is based on Priestley and TAYLOR2 assuming that soil heat flux density is zero. The hargreaves_samani method is based on Hargreaves and Samani3. Defaults to None.

  • pet_params (dict, optional) – Model-specific parameters as a dictionary that is passed to the PET function. Defaults to None.

  • ssl (bool or SSLContext, optional) – SSLContext to use for the connection, defaults to None. Set to False to disable SSL cetification verification.

  • expire_after (int, optional) – Expiration time for response caching in seconds, defaults to -1 (never expire).

  • disable_caching (bool, optional) – If True, disable caching requests, defaults to False.

Returns

pandas.DataFrame – Daily climate data for a location.

Examples

>>> import pydaymet as daymet
>>> coords = (-1431147.7928, 318483.4618)
>>> dates = ("2000-01-01", "2000-12-31")
>>> clm = daymet.get_bycoords(
...     coords,
...     dates,
...     crs="epsg:3542",
...     pet="hargreaves_samani",
...     ssl=False
... )
>>> clm["pet (mm/day)"].mean()
3.713

References

1(1,2)

Richard G Allen, Luis S Pereira, Dirk Raes, Martin Smith, and others. Crop evapotranspiration-guidelines for computing crop water requirements-fao irrigation and drainage paper 56. Fao, Rome, 300(9):D05109, 1998.

2(1,2)

Charles Henry Brian Priestley and Robert Joseph TAYLOR. On the assessment of surface heat flux and evaporation using large-scale parameters. Monthly weather review, 100(2):81–92, 1972.

3(1,2)

George H. Hargreaves and Zohrab A. Samani. Estimating potential evapotranspiration. Journal of the Irrigation and Drainage Division, 108(3):225–230, sep 1982. URL: https://doi.org/10.1061%2Fjrcea4.0001390, doi:10.1061/jrcea4.0001390.

pydaymet.pydaymet.get_bygeom(geometry, dates, crs=DEF_CRS, variables=None, region='na', time_scale='daily', pet=None, pet_params=None, ssl=None, expire_after=EXPIRE, disable_caching=False)

Get gridded data from the Daymet database at 1-km resolution.

Parameters
  • geometry (Polygon, MultiPolygon, or bbox) – The geometry of the region of interest.

  • dates (tuple or list, optional) – Start and end dates as a tuple (start, end) or a list of years [2001, 2010, …].

  • crs (str, optional) – The CRS of the input geometry, defaults to epsg:4326.

  • variables (str or list) – List of variables to be downloaded. The acceptable variables are: tmin, tmax, prcp, srad, vp, swe, dayl Descriptions can be found here.

  • region (str, optional) – Region in the US, defaults to na. Acceptable values are:

    • na: Continental North America

    • hi: Hawaii

    • pr: Puerto Rico

  • time_scale (str, optional) – Data time scale which can be daily, monthly (monthly average), or annual (annual average). Defaults to daily.

  • pet (str, optional) – Method for computing PET. Supported methods are penman_monteith, priestley_taylor, hargreaves_samani, and None (don’t compute PET). The penman_monteith method is based on Allen et al.1 assuming that soil heat flux density is zero. The priestley_taylor method is based on Priestley and TAYLOR2 assuming that soil heat flux density is zero. The hargreaves_samani method is based on Hargreaves and Samani3. Defaults to None.

  • pet_params (dict, optional) – Model-specific parameters as a dictionary that is passed to the PET function. Defaults to None.

  • ssl (bool or SSLContext, optional) – SSLContext to use for the connection, defaults to None. Set to False to disable SSL cetification verification.

  • expire_after (int, optional) – Expiration time for response caching in seconds, defaults to -1 (never expire).

  • disable_caching (bool, optional) – If True, disable caching requests, defaults to False.

Returns

xarray.Dataset – Daily climate data within the target geometry.

Examples

>>> from shapely.geometry import Polygon
>>> import pydaymet as daymet
>>> geometry = Polygon(
...     [[-69.77, 45.07], [-69.31, 45.07], [-69.31, 45.45], [-69.77, 45.45], [-69.77, 45.07]]
... )
>>> clm = daymet.get_bygeom(geometry, 2010, variables="tmin", time_scale="annual")
>>> clm["tmin"].mean().compute().item()
1.361

References