pygridmet.core#
Core class for the GridMET functions.
Module Contents#
- class pygridmet.core.GridMET(dates=2000, variables=None, snow=False)#
Base class for GridMET requests.
- Parameters:
dates (
tuple
orint
orlist
, optional) – Start and end dates as a tuple, (start, end), or a list of years. Defaults to2000
so the class can be initialized without any arguments.variables (
str
orlist
ortuple
, optional) – List of variables to be downloaded. The acceptable variables are:pr
,rmax
,rmin
,sph
,srad
,th
,tmmn
,tmmx
,vs
,bi
,fm100
,fm1000
,erc
,etr
,pet
, andvpd
. Descriptions can be found here. Defaults toNone
, i.e., all the variables are downloaded.snow (
bool
, optional) – Compute snowfall from precipitation and minimum temperature. Defaults toFalse
.
References
- 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 GridMET accounting for leap years.
GridMET doesn’t account for leap years and removes Dec 31 when it’s leap year.
- separate_snow(clm, t_rain=T_RAIN, t_snow=T_SNOW)#
Separate snow based on Martinez and Gupta[1].
- Parameters:
clm (
pandas.DataFrame
orxarray.Dataset
) – Climate data that should includepr
andtmmn
.t_rain (
float
, optional) – Threshold for temperature for considering rain, defaults to 2.5 K.t_snow (
float
, optional) – Threshold for temperature for considering snow, defaults to 0.6 K.
- Returns:
pandas.DataFrame
orxarray.Dataset
– Input data withsnow (mm)
column if input is apandas.DataFrame
, orsnow
variable if input is anxarray.Dataset
.- Return type:
DF
References
- years_todict(years)#
Set date by list of year(s).
- years_tolist(years)#
Correct dates for GridMET accounting for leap years.
GridMET doesn’t account for leap years and removes Dec 31 when it’s leap year.