65 name =
"Example-05a-python.hdf5",
66 mode = ioda.Engines.BackendCreateModes.Truncate_If_Exists)
95 newDims = [ioda.NewDimensionScale.int32(
'nlocs', numLocs, ioda.Unlimited, numLocs),
96 ioda.NewDimensionScale.int32(
'nchans', numChans, numChans, numChans)]
105 nlocsVar = og.vars.open(
'nlocs')
106 nchansVar = og.vars.open(
'nchans')
111 p1.compressWithGZIP()
112 p1.setFillValue.float(-999)
117 tbName =
"ObsValue/brightness_temperature"
118 latName =
"MetaData/latitude"
119 lonName =
"MetaData/longitude"
123 tbVar = g.vars.create(tbName, ioda.Types.float, scales=[nlocsVar, nchansVar], params=p1)
124 latVar = g.vars.create(latName, ioda.Types.float, scales=[nlocsVar], params=p1)
125 lonVar = g.vars.create(lonName, ioda.Types.float, scales=[nlocsVar], params=p1)
129 tbVar.atts.create(
"coordinates", ioda.Types.str, [1]).writeDatum.str(
"longitude latitude nchans")
130 tbVar.atts.create(
"long_name", ioda.Types.str, [1]).writeDatum.str(
"fictional brightness temperature")
131 tbVar.atts.create(
"units", ioda.Types.str, [1]).writeDatum.str(
"K")
132 tbVar.atts.create(
"valid_range", ioda.Types.float, [2]).writeVector.float([100.0, 400.0])
134 latVar.atts.create(
"long_name", ioda.Types.str, [1]).writeDatum.str(
"latitude")
135 latVar.atts.create(
"units", ioda.Types.str, [1]).writeDatum.str(
"degrees_north")
136 latVar.atts.create(
"valid_range", ioda.Types.float, [2]).writeVector.float([-90, 90])
138 lonVar.atts.create(
"long_name", ioda.Types.str, [1]).writeDatum.str(
"degrees_east")
139 lonVar.atts.create(
"units", ioda.Types.str, [1]).writeDatum.str(
"degrees_north")
140 lonVar.atts.create(
"valid_range", ioda.Types.float, [2]).writeVector.float([-360, 360])
147 midChan = numChans / 2
152 lonData = np.fromfunction(
lambda i: 3 * (i % 8), (numLocs,), dtype=float)
153 latData = np.fromfunction(
lambda i: 3 * (i // 8), (numLocs,), dtype=float)
156 tbData = np.fromfunction(
lambda iloc, ich: 250 + (((iloc - midLoc)**2 + (ich-midChan)**2))**0.5, (numLocs, numChans), dtype=float)
159 lonVar.writeNPArray.float(lonData)
160 latVar.writeNPArray.float(latData)
161 tbVar.writeNPArray.float(tbData)
static ObsGroup generate(Group &emptyGroup, const NewDimensionScales_t &fundamentalDims, std::shared_ptr< const detail::DataLayoutPolicy > layout=nullptr)
Create an empty ObsGroup and populate it with the fundamental dimensions.
IODA_DL Group createFile(const std::string &filename, BackendCreateModes mode, HDF5_Version_Range compat=defaultVersionRange())
Create a ioda::Group backed by an HDF5 file.
Used to specify Variable creation-time properties.