Commit b0468758 authored by Carl Schreck's avatar Carl Schreck

Starting to work on calc_prism_diff.py

parent 762ac7a7
......@@ -8,20 +8,40 @@ __license__ = "BSD-3.0"
import xarray as xr
import sys
import argparse
import os
import cjs # '~carl/lib/python'
cjs.tstamp('Here we go!')
# These are some parameters that could be useful to have up top
parser = argparse.ArgumentParser()
parser.add_argument('--var_name', default='tmin')
parser.add_argument('--var_name', default='tavg')
parser.add_argument('--month', default=9)
args = parser.parse_args()
var_name = args.var_name
min_year = 1981
max_year = 1982
years = range(1981,1982+1)
for year in
ncg_var_to_prism_var = {
'tmin': 'tmin',
'tmax': 'tmax',
'tavg': 'tmean',
'precp': 'ppt',
}
ncg_var = var_name
prism_var = ncg_var_to_prism_var[ncg_var]
for year in years:
ncg_path = f'{os.environ["DATA_DIR"]}/nclimgrid/beta/{ncg_var}/' \
f'{ncg_var}-{year}{month:02}-grd-scaled.nc'
prism_path = f'{os.environ["DATA_DIR"]}/prism/netcdf/' \
f'PRISM_{prism_var}_{year}{month:02}.nc'
ncg_ds = xr.open_dataset(ncg_path)
prism_ds = xr.open_dataset(prism_path)
if year == years[0]:
ncg_lat = ncg_ds.lat
ncg_lon = ncg_ds.lon
# make output vars that look like ncg
# sub_prism = subset using ncg lat/lon
cjs.tstamp('Thank you, come again.')
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment