Commit 86f7e4f0 authored by Carl Schreck's avatar Carl Schreck

Changing data type

parent 87c636f8
......@@ -13,21 +13,25 @@ mkdir -p $LOG_DIR
for month in {1..12}
do
JOB_NAME=prism_to_netcdf"_"$month
echo $JOB_NAME `date`
LOG_FILE=$LOG_DIR/$JOB_NAME.log
ERR_FILE=$LOG_DIR/$JOB_NAME.err
# for var_name in tmin tmax tmean ppt
for var_name in tmean ppt
do
JOB_NAME=prism_to_netcdf"_"$var_name"_"$month
echo $JOB_NAME `date`
LOG_FILE=$LOG_DIR/$JOB_NAME.log
ERR_FILE=$LOG_DIR/$JOB_NAME.err
rm $LOG_FILE $ERR_FILE
bsub \
-J $JOB_NAME \
-o $LOG_FILE \
-e $ERR_FILE \
-q $QUEUE \
-n 1 -R "span[hosts=1]" -W 48:00 \
-sp 75 \
$PY_DIR/run_prism_to_netcdf.sh $PY_DIR $month
rm $LOG_FILE $ERR_FILE
bsub \
-J $JOB_NAME \
-o $LOG_FILE \
-e $ERR_FILE \
-q $QUEUE \
-n 1 -R "span[hosts=1]" -W 48:00 \
-sp 75 \
$PY_DIR/run_prism_to_netcdf.sh $PY_DIR $month $var_name
done
done
......
......@@ -29,14 +29,14 @@ cjs.tstamp(f'{year}--{month}')
var_name_to_long_name = {
'tmin': 'Minimum Temperature',
'tmax': 'Maximum Temperature',
'tave': 'Average Temperature',
'prcp': 'Precipitation',
'tmean': 'Average Temperature',
'ppt': 'Precipitation',
}
var_name_to_units = {
'tmin': 'degree_Celsius',
'tmax': 'degree_Celsius',
'tave': 'degree_Celsius',
'prcp': 'mm',
'tmean': 'degree_Celsius',
'ppt': 'mm',
}
xllcorner = -125.020833333333
......@@ -64,7 +64,8 @@ time = xr.DataArray(pd.date_range(f'{year}-{month:02}-01',
attrs={'long_name': 'time'})
time.assign_coords(time=time)
out_data = xr.DataArray(np.full((len(time),len(lat), len(lon)), np.nan),
out_data = xr.DataArray(np.full((len(time),len(lat), len(lon)), np.nan,
dtype='float32'),
coords=[time, lat, lon],
name=var_name,
dims=['time', 'lat', 'lon'],
......@@ -72,7 +73,7 @@ out_data = xr.DataArray(np.full((len(time),len(lat), len(lon)), np.nan),
'units': var_name_to_units[var_name]})
out_path = f'{os.environ["DATA_DIR"]}/prism/netcdf/' \
f'{var_name}-{year}{month:02}.nc'
f'PRISM_{var_name}_{year}{month:02}.nc'
for curr_time in time.values:
ts = pd.to_datetime(str(curr_time))
file_name = f'PRISM_{var_name}_{ts.strftime("%Y%m%d")}'
......
......@@ -2,6 +2,7 @@
py_dir=$1
month=$2
var_name=$3
echo $py_dir
echo $month
......@@ -11,6 +12,6 @@ export MPLBACKEND="agg"
for year in {1981..2018}
do
python -u prism_to_netcdf.py --year $year --month $month
python -u prism_to_netcdf.py --year $year --month $month --var_name $var_name
done
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