diff --git a/src/python/devel/extremes/original/make_extrema_longrun_3day.py b/src/python/devel/extremes/original/make_extrema_longrun_3day.py index 3ffc41974..f35ce958c 100644 --- a/src/python/devel/extremes/original/make_extrema_longrun_3day.py +++ b/src/python/devel/extremes/original/make_extrema_longrun_3day.py @@ -1,19 +1,20 @@ +# Revision by MFW 08/10/2018: Removed the 4 seasons for speed. Added some comments # Adapted for numpy/ma/cdms2 by convertcdms.py # Calculate annual and seasonal extrema from a dataset of daily averages # suitable for input into a return value calculation. import MV2 as MV, cdtime,os, cdms2 as cdms, sys, string -#NCAR Control runs have no leap years. Historical runs do. +#Note: NCAR Control runs have no leap years. Historical runs do. #cdms.setNetcdfShuffleFlag(0) #cdms.setNetcdfDeflateFlag(0) #cdms.setNetcdfDeflateLevelFlag(0) -# Calculate annual and seasonal 3 day extrema from a dataset of daily averages +# Calculate annual 3 day extrema from a dataset of daily averages # suitable for input into a return value calculation or comparison between models and observations. # example execute line: # python make_extrema_longrun_3day.py var model_scenario_realization var_file lat_name date_range # Where: -# var is the variable name +# var is the variable name (for the PMP this is either tasmax or tasmin or the negative of these) # model_scenario_realization is a descriptor for the output file # var_file is the input file of daily data. An xml file constructed with cdscan works here. # lat_name is the name of the latitude dimension @@ -24,6 +25,15 @@ # However, the prefix of the name of the output variable is unchanged from the input variable name. # The suffix of the name of the output variable reflects the season. +# PMP specific instructions for Peter regarding output file and variable names. Not sure how you want to deal with this +# If var== tasmax, the change the variable name to TX3x +# If var== -tasmax, the change the variable name to TX3n +# If var== tasmin, the change the variable name to TN3x +# If var== -tasmin, the change the variable name to TN3n +# If var== -tasmax or -tasmin, multiply the final answer by -1 to make it positive again. +# And change output file names accordingly + + var=sys.argv[1] f=cdms.open(sys.argv[3]) @@ -128,190 +138,4 @@ daily_max.id=var+'_annual_daily_max' output.write(daily_max) -# Calculate DJF extrema -print("starting DJF") -y1=y0 -m1=11 # December -d1=27 -m2=2 # February -d2=28 -y=0 -while y1beg : b=i - if t1=end : e=i+1 - s1=f.getslab(var,tim[b+1],tim[e+1]) - if var=='pr' or var=='precip' or var=='PRECT':s1.missing_value=0.0 - ndays=s1.shape[0] - s=0.*s1 - ii=2 - while iibeg : b=i - if t1=end : e=i+1 -# Compute the extrema of the daily average values for year=Y - s1=f.getslab(var,tim[b+1],tim[e+1]) - ndays=s1.shape[0] - s=0.*s1 - ii=2 - while iibeg : b=i - if t1=end : e=i+1 -# Compute the extrema of the daily average values for year=Y - s1=f.getslab(var,tim[b+1],tim[e+1]) - ndays=s1.shape[0] - s=0.*s1 - ii=2 - while iibeg : b=i - if t1=end : e=i+1 -# Compute the extrema of the daily average values for year=Y - s1=f.getslab(var,tim[b+1],tim[e+1]) - ndays=s1.shape[0] - s=0.*s1 - ii=2 - while ii