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

Function _get_proj_params

src/wrf/latlonutils.py:84–198  ·  view source on GitHub ↗

Return the map projection parameters. Args: wrfin (:class:`netCDF4.Dataset`, :class:`Nio.NioFile`, or an \ iterable): WRF-ARW NetCDF data as a :class:`netCDF4.Dataset`, :class:`Nio.NioFile` or an iterable sequence of the aforementioned types.

(wrfin, timeidx, stagger, method, squeeze, cache, _key)

Source from the content-addressed store, hash-verified

82
83
84def _get_proj_params(wrfin, timeidx, stagger, method, squeeze, cache, _key):
85 """Return the map projection parameters.
86
87 Args:
88
89 wrfin (:class:`netCDF4.Dataset`, :class:`Nio.NioFile`, or an \
90 iterable): WRF-ARW NetCDF
91 data as a :class:`netCDF4.Dataset`, :class:`Nio.NioFile`
92 or an iterable sequence of the aforementioned types.
93
94 timeidx (:obj:`int` or :data:`wrf.ALL_TIMES`, optional): The
95 desired time index. This value can be a positive integer,
96 negative integer, or
97 :data:`wrf.ALL_TIMES` (an alias for None) to return
98 all times in the file or sequence. The default is 0.
99
100 stagger (:obj:`str`): The staggered grid type, which is one of the
101 following:
102
103 - 'm': Use the mass grid (default).
104 - 'u': Use the same staggered grid as the u wind component,
105 which has a staggered west_east (x) dimension.
106 - 'v': Use the same staggered grid as the v wind component,
107 which has a staggered south_north (y) dimension.
108
109 method (:obj:`str`, optional): The aggregation method to use for
110 sequences. Must be either 'cat' or 'join'.
111 'cat' combines the data along the Time dimension.
112 'join' creates a new dimension for the file index.
113 The default is 'cat'.
114
115 squeeze (:obj:`bool`, optional): Set to False to prevent dimensions
116 with a size of 1 from being automatically removed from the shape
117 of the output. Default is True.
118
119 cache (:obj:`dict`, optional): A dictionary of (varname, ndarray)
120 that can be used to supply pre-extracted NetCDF variables to the
121 computational routines. It is primarily used for internal
122 purposes, but can also be used to improve performance by
123 eliminating the need to repeatedly extract the same variables
124 used in multiple diagnostics calculations, particularly when using
125 large sequences of files.
126 Default is None.
127
128 _key (:obj:`int`, optional): A caching key. This is used for internal
129 purposes only. Default is None.
130
131 Returns:
132
133
134 """
135 if timeidx is not None:
136 if timeidx < 0:
137 raise ValueError("'timeidx' must be greater than 0")
138
139 attrs = extract_global_attrs(wrfin, attrs=("MAP_PROJ", "TRUELAT1",
140 "TRUELAT2", "STAND_LON",
141 "DX", "DY"))

Callers 2

_ll_to_xyFunction · 0.85
_xy_to_llFunction · 0.85

Calls 8

extract_global_attrsFunction · 0.85
_lat_varnameFunction · 0.85
_lon_varnameFunction · 0.85
is_moving_domainFunction · 0.85
is_multi_fileFunction · 0.85
is_mappingFunction · 0.85
viewkeysFunction · 0.85
extract_varsFunction · 0.85

Tested by

no test coverage detected