5 from copy
import deepcopy
7 import basic_plot_functions
12 Directory structure and file names for ctest (or cycling experiments):
15 │ ├── sondes_obs_2018041500_m.nc4 (or sondes_obs_2018041500.h5)
16 │ ├── satwind_obs_2018041500_m.nc4 (or satwind_obs_2018041500.h5)
22 python plot_obs_loc.py cycling 2018041500
23 python plot_obs_loc.py ctest 2018041500
25 test = str(sys.argv[1])
26 Date = str(sys.argv[2])
30 Observation file name used in ctest: | Observation file name used in cycling:
31 aircraft_obs_2018041500_m.nc4 | aircraft_obs_2018041500.h5
32 amsua_n19_obs_2018041500_m.nc4 | amsua_n19_obs_2018041500.h5
33 satwind_obs_2018041500_m.nc4 | satwind_obs_2018041500.h5
34 sondes_obs_2018041500_m.nc4 | sondes_obs_2018041500.h5
35 gnssro_obs_2018041500_s.nc4 | gnssro_obs_2018041500.h5
40 string =
'_obs_'+Date+suffix+
'.nc4'
43 elif (test ==
'cycling'):
45 string =
'_obs_'+Date+suffix+
'.h5'
50 PreQCMinvalueConv = -90
51 PreQCMaxvalueAmsua = 0
55 for files
in os.listdir(
'../Data/'):
56 if fnmatch.fnmatch(files,
'*'+string):
57 allobstypes.append(files[:nChar1])
62 for (key,baseval)
in conf.DiagSpaceConfig.items():
63 if baseval[
'process']
and baseval[
'DiagSpaceGrp'] != conf.model_s:
64 ObsSpaceDict = deepcopy(baseval)
65 obsfiles_prefix.append(key)
68 match = set(allobstypes) & set(obsfiles_prefix)
69 print(
'match=', match)
70 obsfiles = [x + string
for x
in match]
73 obsfiles = [f.replace(
'gnssro_obs_2018041500_m.nc4',
'gnssro_obs_2018041500_s.nc4')
for f
in obsfiles]
76 for file_name
in obsfiles:
77 nc = h5.File(
"../Data/"+file_name,
'r')
78 print(
'Plotting:', file_name)
81 if type(nc[node])
is h5._hl.group.Group:
83 varlist += [node+
'/'+var]
85 if 'MetaData/station_id' in varlist:
86 stationidnc = nc[
'MetaData/station_id']
88 elif 'MetaData/occulting_sat_id' in varlist:
89 stationidnc = nc[
'MetaData/occulting_sat_id']
90 if (test ==
'cycling'):
91 recordNum = nc[
'MetaData/record_number']
96 obstype = file_name[:nChar1]
97 latnc = nc[
'MetaData/latitude']
98 lonnc = nc[
'MetaData/longitude']
100 ObsSpaceInfo = conf.DiagSpaceConfig.get(obstype,conf.nullDiagSpaceInfo)
101 channels = ObsSpaceInfo.get(
'channels',[vu.miss_i])
103 obslist = [obs
for obs
in varlist
if (obs[:8] ==
'ObsValue')]
106 obs_type = file_name[:nChar1]
107 out_name = file_name[:nChar2]
111 PreQC =
'PreQC/'+var_name
113 if var_name ==
'refractivity':
115 elif var_name ==
'bending_angle':
118 var_unit = vu.varDictObs[var_name][0]
122 if channels[0] == vu.miss_i:
124 obsnc = np.asarray(obsnc)
125 stationidnc_array = []
127 if (obstype ==
'gnssro'):
128 obsnc[np.less(obsnc, -999)] = np.NaN
129 stationidnc_array=np.asarray(stationidnc).astype(str)
130 if (test ==
'cycling'):
131 recordnc_array=np.asarray(recordNum).astype(str)
132 recordnc_array[np.isnan(obsnc)]= np.NaN
133 nrecord = len(set(recordnc_array)) -1
136 obsnc[np.greater(PreQCnc, PreQCMaxvalueConv)] = np.NaN
137 obsnc[np.less(PreQCnc,PreQCMinvalueConv)] = np.NaN
138 stationidnc_array=np.asarray(stationidnc)
139 stationidnc_array[np.isnan(obsnc)]= np.NaN
140 nstation = len(set(stationidnc_array)) -1
141 if (obstype ==
'satwind'):
143 if (obstype ==
'gnssro' and test ==
'cycling'):
148 for channel
in channels:
149 obsnc = nc[var][:,channel-1]
150 PreQCnc = nc[PreQC][:,channel-1]
151 obsnc = np.asarray(obsnc)
152 obsnc[np.greater(PreQCnc, PreQCMaxvalueAmsua)] = np.NaN
153 var_name = var_name +
'_ch'+ str(channel)
160 if __name__ ==
'__main__':
main()
def plotDistri(lats, lons, values, ObsType, VarName, var_unit, out_name, nstation, levbin, dmin=None, dmax=None, dotsize=6, color="rainbow")