A base class for storing map projection information from WRF data. Subclasses of this type will be stored in the 'projection' attribute entry within a :attr:`xarray.DataArray.attrs` dictionary. This base class contains the methods required to extract the appropriate projection class
| 122 | |
| 123 | |
| 124 | class WrfProj(object): |
| 125 | """A base class for storing map projection information from WRF data. |
| 126 | |
| 127 | Subclasses of this type will be stored in the 'projection' attribute |
| 128 | entry within a :attr:`xarray.DataArray.attrs` dictionary. This base class |
| 129 | contains the methods required to extract the appropriate projection class |
| 130 | for PyNGL, matplotlib basemap, and cartopy. |
| 131 | |
| 132 | Attributes: |
| 133 | |
| 134 | map_proj (:obj:`int`): Model projection integer id. |
| 135 | |
| 136 | truelat1 (:obj:`float`): True latitude 1. |
| 137 | |
| 138 | truelat2 (:obj:`float`): True latitude 2. |
| 139 | |
| 140 | moad_cen_lat (:obj:`float`): Mother of all domains center latitude. |
| 141 | |
| 142 | stand_lon (:obj:`float`): Standard longitude. |
| 143 | |
| 144 | pole_lat (:obj:`float`): The pole latitude. |
| 145 | |
| 146 | pole_lon (:obj:`float`): The pole longitude. |
| 147 | |
| 148 | dx (:obj:`float`): The x grid spacing. |
| 149 | |
| 150 | dy (:obj:`float`): The y grid spacing. |
| 151 | |
| 152 | |
| 153 | """ |
| 154 | def __init__(self, **proj_params): |
| 155 | """Initialize a :class:`wrf.WrfProj` object. |
| 156 | |
| 157 | Args: |
| 158 | |
| 159 | **proj_params: Map projection optional keyword arguments, that |
| 160 | have the same names as found in WRF output NetCDF global |
| 161 | attributes (case insensitive): |
| 162 | |
| 163 | - 'MAP_PROJ': The map projection type as an integer. |
| 164 | - 'TRUELAT1': True latitude 1. |
| 165 | - 'TRUELAT2': True latitude 2. |
| 166 | - 'MOAD_CEN_LAT': Mother of all domains center latitude. |
| 167 | - 'STAND_LON': Standard longitude. |
| 168 | - 'POLE_LAT': Pole latitude. |
| 169 | - 'POLE_LON': Pole longitude. |
| 170 | |
| 171 | """ |
| 172 | |
| 173 | up_proj_params = dict_keys_to_upper(proj_params) |
| 174 | |
| 175 | self.map_proj = up_proj_params.get("MAP_PROJ", None) |
| 176 | |
| 177 | # These indicate the center of the nest/domain, not necessarily the |
| 178 | # center of the projection |
| 179 | self._cen_lat = up_proj_params.get("CEN_LAT", None) |
| 180 | self._cen_lon = up_proj_params.get("CEN_LON", None) |
| 181 |