5 from netCDF4
import Dataset
8 import matplotlib.cm
as cm
9 import matplotlib.pyplot
as plt
10 from mpl_toolkits.basemap
import Basemap
11 from copy
import deepcopy
13 from datetime
import datetime, timedelta
14 import numpy.random
as npr
15 import var_utils
as vu
16 import modelsp_utils
as mu
18 expStats =
'expmgfsci.nc'
25 for metrics
in allmetrics:
27 for varName
in mu.varNames3d:
28 for latBand
in mu.latBands:
29 for fcTDelta
in np.arange(0, mu.fcRange+mu.interval,mu.interval):
30 varNamesList = [
'expmgfs_day'+str(fcTDelta)+
'_'+ latBand +
'_'+ varName +
'_' + metrics]
31 varNamesListAll.append(varNamesList)
32 for metrics
in allmetrics:
34 for varName
in mu.varNames:
35 for latBand
in mu.latBands:
37 varNamesList2 = [
'expmgfs_'+ latBand +
'_'+ varName +
'_' + metrics]
38 varNamesListAll.append(varNamesList2)
40 for i
in range(0,len(varNamesListAll)):
41 nc_file = mu.EXP_DIR2+
'/'+mu.endDate+
'/diagnostic_stats/expmgfsci.nc'
42 nc_fid = Dataset(nc_file,
"r", format=
"NETCDF4")
44 data = np.array( nc_fid.variables[
''.join(varNamesListAll[i])][:] )
46 t = list(np.arange(0,x,1))
47 varName =
''.join(varNamesListAll[i])
48 if (x == 55
or x == 56):
49 region =
''.join(varName.split(
"_")[2:][:-2])
50 var =
'_'.join(varName.split(
"_")[3:][:-1])
51 stats =
''.join(varName.split(
"_")[4:])
52 plt.title(stats+
' variable:'+vu.varDictModel[var][1]+
'('+ vu.varDictModel[var][0]+
') '+region, fontsize = 12)
54 plt.fill_betweenx( t, data[:,1],data[:,2],alpha=0.3, linestyle=
'-.')
55 plt.plot([0,0],[0, x], ls=
"--", c=
".3")
56 plt.xlabel(
'RMS('+mu.exp2Name+
')-RMS('+mu.exp1Name+
')',fontsize=15)
57 plt.ylabel(
'Levels',fontsize=15)
59 region =
''.join(varName.split(
"_")[1:][:-2])
60 var =
'_'.join(varName.split(
"_")[2:][:-1])
61 stats =
''.join(varName.split(
"_")[3:])
62 plt.title(stats+
' variable:'+vu.varDictModel[var][1]+
'('+ vu.varDictModel[var][0]+
') '+region, fontsize = 12)
64 plt.fill_between( t,data[:,1],data[:,2],alpha=0.3, linestyle=
'-.')
65 plt.plot([0, x],[0,0], ls=
"--", c=
".3")
66 plt.ylabel(
'RMS('+mu.exp2Name+
')-RMS('+mu.exp1Name+
')',fontsize=15)
67 plt.xlabel(
'Lead Time (day)',fontsize=15)
70 plt.savefig(
''.join(varNamesListAll[i])+
'_ci.png',dpi=200,bbox_inches=
'tight')
76 if __name__ ==
'__main__':
main()