Skip to content

Instantly share code, notes, and snippets.

@selimnairb
Created June 26, 2014 02:05
Show Gist options
  • Save selimnairb/6d1e6d1dbe0b2ed5ef5e to your computer and use it in GitHub Desktop.
Save selimnairb/6d1e6d1dbe0b2ed5ef5e to your computer and use it in GitHub Desktop.
Bare bones script for estimating yearly pan evaporation for a GHCN station using ulmo
import ulmo
print("Downloading GHCN daily data for station USC00311677...")
nc_data = ulmo.ncdc.ghcn_daily.get_data('USC00311677', as_dataframe=True)
nc_evap = nc_data['EVAP'].copy().value # evaporation in 1/10-mm
nc_evap = nc_evap.truncate(before='1950-01-01', after='2009-12-30')
nc_evap = nc_evap.fillna(value=0)
nc_evap_yearly = nc_evap.resample('A', how='sum') # get yearly sum
nc_evap_yearly_filter = nc_evap_yearly[nc_evap_yearly > 1000] # Filter out very low yearly totals
nc_evap_avg_mm = nc_evap_yearly_filter.mean() / 10
print("Mean yearly pan evaporation, Chapel Hill, NC, 1950-2009: {:.2f}-mm".format(nc_evap_avg_mm))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment