14 if os.environ.get(
'LIBDIR')
is not None:
15 sys.path.append(os.environ[
'LIBDIR'])
30 mode = ioda.Engines.BackendOpenModes.Read_Only)
38 chansDimName =
"nchans"
40 locsDimVar = og.vars.open(locsDimName)
41 chansDimVar = og.vars.open(chansDimName)
43 locsCoords = locsDimVar.readVector.int()
44 chansCoords = chansDimVar.readVector.int()
46 numLocs = len(locsCoords)
47 numChans = len(chansCoords)
49 print(
"INFO: locations dimension: ", locsDimName,
" (", numLocs,
")")
50 print(
"INFO: coordinates: ")
51 for i
in range(numLocs):
52 print(
"INFO: ", i,
" --> ", locsCoords[i])
55 print(
"INFO: channels dimension: ", chansDimName,
" (", numChans,
")")
56 print(
"INFO: coordinates: ")
57 for i
in range(numChans):
58 print(
"INFO: ", i,
" --> ", chansCoords[i])
67 tbName =
"ObsValue/brightness_temperature"
68 hofxName =
"hofx/brightness_temperature"
69 latName =
"MetaData/latitude"
70 lonName =
"MetaData/longitude"
72 tbVar = og.vars.open(tbName)
73 hofxVar = og.vars.open(hofxName)
74 latVar = og.vars.open(latName)
75 lonVar = og.vars.open(lonName)
77 tbData = tbVar.readNPArray.float()
78 hofxData = hofxVar.readNPArray.float()
79 latData = latVar.readVector.float()
80 lonData = lonVar.readVector.float()
82 print(
"INFO: input Tb variable: ", tbName,
" (", tbData.shape,
")")
83 print(
"INFO: output Tb H(x) variable: ", hofxName,
" (", hofxData.shape,
")")
84 print(
"INFO: latitude variable: ", latName,
" (", len(latData),
")")
85 print(
"INFO: longitude variable: ", lonName,
" (", len(lonData),
")")
89 chanIndex = chansCoords.index(7)
91 tbDataCh7 = tbData[:, chanIndex]
92 hofxDataCh7 = hofxData[:, chanIndex]
94 print(
"INFO: Channel 7 is located at channel index: ", chanIndex)
95 print(
"INFO: input Tb variable, channel 7: ", tbName,
" (", tbDataCh7.shape,
")")
96 print(
"INFO: output Tb H(x) variable, channel 7: ", hofxName,
" (", hofxDataCh7.shape,
")")
An ObsGroup is a specialization of a ioda::Group. It provides convenience functions and guarantees th...
IODA_DL Group openFile(const std::string &filename, BackendOpenModes mode, HDF5_Version_Range compat=defaultVersionRange())
Open a ioda::Group backed by an HDF5 file.