MCPcopy Create free account
hub / github.com/NCAR/wrf-python / _extract_time_map

Function _extract_time_map

src/wrf/util.py:2370–2401  ·  view source on GitHub ↗

Return a mapping of key to a sequence of time objects. This function is used when *wrfin* is a mapping. Args: wrfin (:class:`netCDF4.Dataset`, :class:`Nio.NioFile`, or an \ iterable): WRF-ARW NetCDF data as a :class:`netCDF4.Dataset`, :class:`Nio.NioFile`

(wrfin, timeidx, do_xtime, meta=False)

Source from the content-addressed store, hash-verified

2368
2369
2370def _extract_time_map(wrfin, timeidx, do_xtime, meta=False):
2371 """Return a mapping of key to a sequence of time objects.
2372
2373 This function is used when *wrfin* is a mapping.
2374
2375 Args:
2376
2377 wrfin (:class:`netCDF4.Dataset`, :class:`Nio.NioFile`, or an \
2378 iterable): WRF-ARW NetCDF
2379 data as a :class:`netCDF4.Dataset`, :class:`Nio.NioFile`
2380 or an iterable sequence of the aforementioned types.
2381
2382 timeidx (:obj:`int` or :data:`wrf.ALL_TIMES`): The
2383 desired time index. This value can be a positive integer,
2384 negative integer, or
2385 :data:`wrf.ALL_TIMES` (an alias for None) to return
2386 all times in the file or sequence.
2387
2388 do_xtime (:obj:`bool`): Set to True to parse the 'XTIME' variable
2389 instead of the 'Times' variable.
2390
2391 meta (:obj:`bool`, optional): Set to False to disable metadata.
2392
2393 Returns:
2394
2395 :obj:`dict`: A mapping of key to a sequence of time objects. If
2396 *meta* is True, the sequence will be of type :class:`xarray.DataArray`,
2397 otherwise the sequence is :class:`numpy.ndarray`.
2398
2399 """
2400 return {key: extract_times(wrfseq, timeidx, do_xtime, meta)
2401 for key, wrfseq in viewitems(wrfin)}
2402
2403
2404def extract_times(wrfin, timeidx, method="cat", squeeze=True, cache=None,

Callers 1

extract_timesFunction · 0.85

Calls 2

extract_timesFunction · 0.85
viewitemsFunction · 0.85

Tested by

no test coverage detected