pydaymet.core#

Core class for the Daymet functions.

Module Contents#

class pydaymet.core.Daymet(variables=None, pet=None, snow=False, time_scale='daily', region='na')#

Base class for Daymet requests.

Parameters
  • variables (str or list or tuple, optional) – List of variables to be downloaded. The acceptable variables are: tmin, tmax, prcp, srad, vp, swe, dayl Descriptions can be found here. Defaults to None i.e., all the variables are downloaded.

  • 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.

  • snow (bool, optional) – Compute snowfall from precipitation and minimum temperature. Defaults to False.

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

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

    • na: Continental North America

    • hi: Hawaii

    • pr: Puerto Rico

References

1

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

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

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.

static check_dates(dates)#

Check if input dates are in correct format and valid.

dates_todict(dates)#

Set dates by start and end dates as a tuple, (start, end).

dates_tolist(dates)#

Correct dates for Daymet accounting for leap years.

Daymet doesn’t account for leap years and removes Dec 31 when it’s leap year.

Parameters

dates (tuple) – Target start and end dates.

Returns

list – All the dates in the Daymet database within the provided date range.

separate_snow(clm, t_rain=T_RAIN, t_snow=T_SNOW)#

Separate snow based on Martinez and Gupta4.

Parameters
  • clm (pandas.DataFrame or xarray.Dataset) – Climate data that should include prcp and tmin.

  • t_rain (float, optional) – Threshold for temperature for considering rain, defaults to 2.5 degrees C.

  • t_snow (float, optional) – Threshold for temperature for considering snow, defaults to 0.6 degrees C.

Returns

pandas.DataFrame or xarray.Dataset – Input data with snow (mm/day) column if input is a pandas.DataFrame, or snow variable if input is an xarray.Dataset.

References

4

Guillermo F. Martinez and Hoshin V. Gupta. Toward improved identification of hydrological models: a diagnostic evaluation of the “abcd” monthly water balance model for the conterminous united states. Water Resources Research, 2010. URL: https://agupubs.onlinelibrary.wiley.com/doi/abs/10.1029/2009WR008294, arXiv:https://agupubs.onlinelibrary.wiley.com/doi/pdf/10.1029/2009WR008294, doi:https://doi.org/10.1029/2009WR008294.

years_todict(years)#

Set date by list of year(s).

years_tolist(years)#

Correct dates for Daymet accounting for leap years.

Daymet doesn’t account for leap years and removes Dec 31 when it’s leap year.

Parameters

years (list) – A list of target years.

Returns

list – All the dates in the Daymet database within the provided date range.