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

Function getproj

src/wrf/projection.py:1115–1159  ·  view source on GitHub ↗

Return a :class:`wrf.WrfProj` subclass. This functions serves as a factory function for returning a :class:`wrf.WrfProj` subclass from the specified map projection parameters. Args: **proj_params: Map projection optional keyword arguments, that have the same names

(**proj_params)

Source from the content-addressed store, hash-verified

1113
1114
1115def getproj(**proj_params):
1116 """Return a :class:`wrf.WrfProj` subclass.
1117
1118 This functions serves as a factory function for returning a
1119 :class:`wrf.WrfProj` subclass from the specified map projection parameters.
1120
1121 Args:
1122
1123 **proj_params: Map projection optional keyword arguments, that
1124 have the same names as found in WRF output NetCDF global
1125 attributes:
1126
1127 - 'MAP_PROJ': The map projection type as an integer.
1128 - 'TRUELAT1': True latitude 1.
1129 - 'TRUELAT2': True latitude 2.
1130 - 'MOAD_CEN_LAT': Mother of all domains center latitude.
1131 - 'STAND_LON': Standard longitude.
1132 - 'POLE_LAT': Pole latitude.
1133 - 'POLE_LON': Pole longitude.
1134
1135 Returns:
1136
1137 :class:`wrf.WrfProj`: A :class:`wrf.WrfProj` subclass for the
1138 specified map projection parameters.
1139
1140 """
1141 up_proj_params = dict_keys_to_upper(proj_params)
1142
1143 proj_type = up_proj_params.get("MAP_PROJ", 0)
1144 if proj_type == ProjectionTypes.LAMBERT_CONFORMAL:
1145 return LambertConformal(**proj_params)
1146 elif proj_type == ProjectionTypes.POLAR_STEREOGRAPHIC:
1147 return PolarStereographic(**proj_params)
1148 elif proj_type == ProjectionTypes.MERCATOR:
1149 return Mercator(**proj_params)
1150 elif (proj_type == ProjectionTypes.ZERO or
1151 proj_type == ProjectionTypes.LAT_LON):
1152 if (up_proj_params.get("POLE_LAT", None) == 90.
1153 and up_proj_params.get("POLE_LON", None) == 0.):
1154 return LatLon(**proj_params)
1155 else:
1156 return RotatedLatLon(**proj_params)
1157 else:
1158 # Unknown projection
1159 return WrfProj(**proj_params)

Callers 3

make_testFunction · 0.90
_build_data_arrayFunction · 0.85
_get_wrf_proj_geobndsFunction · 0.85

Calls 7

dict_keys_to_upperFunction · 0.85
LambertConformalClass · 0.85
PolarStereographicClass · 0.85
MercatorClass · 0.85
LatLonClass · 0.85
RotatedLatLonClass · 0.85
WrfProjClass · 0.85

Tested by 1

make_testFunction · 0.72