Skip to content

Commit

Permalink
runoff units fix (#371)
Browse files Browse the repository at this point in the history
* runoff units fix

* add back streamflow test
  • Loading branch information
chengzhuzhang authored Dec 18, 2020
1 parent 897dd28 commit d4f607b
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
3 changes: 2 additions & 1 deletion acme_diags/derivations/acme.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ def mask_by(input_var, maskvar, low_limit=None, high_limit=None):


def qflxconvert_units(var):
if var.units == 'kg/m2/s' or var.units == 'kg m-2 s-1':
if var.units == 'kg/m2/s' or var.units == 'kg m-2 s-1' or var.units == 'mm/s':
# need to find a solution for units not included in udunits
# var = convert_units( var, 'kg/m2/s' )
var = var * 3600.0 * 24 # convert to mm/day
Expand Down Expand Up @@ -865,6 +865,7 @@ def cosp_histogram_standardize(cld):
(('mrros',), rename)
]),
'QRUNOFF': OrderedDict([
(('QRUNOFF',), lambda qrunoff: qflxconvert_units(qrunoff)),
(('mrro',), rename)
]),
'QINTR': OrderedDict([
Expand Down
6 changes: 3 additions & 3 deletions analysis_data_preprocess/create_ISLSCPII_COMP_RUNOFF_climo.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,21 +13,21 @@ mkdir $tmp
cd $time_series_output_path
echo $path

cdo splityear QRUNOFF_198601_199512.nc ${tmp}QRUNOFF
cdo splityear QRUNOFF_198601_199512.nc ${tmp}ISLSCPII_GRDC

for yr in {1986..1995}; do
yyyy=`printf "%04d" $yr`

for mth in {1..12}; do
mm=`printf "%02d" $mth`
ncks -O -F -d time,${mth} ${tmp}QRUNOFF${yyyy}.nc ${tmp}QRUNOFF_${yyyy}${mm}.nc
ncks -O -F -d time,${mth} ${tmp}ISLSCPII_GRDC${yyyy}.nc ${tmp}ISLSCPII_GRDC_${yyyy}${mm}.nc
done
done



cd ${tmp}
ncclimo -a sdd --lnk_flg -c QRUNOFF_198601.nc -s 1986 -e 1995
ncclimo -a sdd -c ISLSCPII_GRDC_198601.nc -s 1986 -e 1995
mv *climo.nc $climo_output_path


Expand Down
2 changes: 1 addition & 1 deletion analysis_data_preprocess/process_ISLSCPII_COMP_RUNOFF.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
data_mon = numpy.loadtxt(fname, skiprows=6)
print(data_mon.shape)
data_mon = data_mon[::-1,:]
data[count,:,:] = data_mon / days_per_month * 24. * 3600. #converted from mm/month to kg/m2/s
data[count,:,:] = data_mon / days_per_month /24.0/3600.0 #converted from mm/day to kg/m2/s
count = count+1

print(count)
Expand Down

0 comments on commit d4f607b

Please sign in to comment.