Browse Source

Merge branch 'bugfix/issue_63' into develop

lon0
Bill Ladwig 6 years ago
parent
commit
6732c13bba
  1. 39
      src/wrf/g_latlon.py
  2. 9
      src/wrf/routines.py

39
src/wrf/g_latlon.py

@ -547,17 +547,18 @@ def ll_to_xy_proj(latitude, longitude, meta=True, squeeze=True, as_int=True, @@ -547,17 +547,18 @@ def ll_to_xy_proj(latitude, longitude, meta=True, squeeze=True, as_int=True,
as_int (:obj:`bool`): Set to False to return the x,y values as
:obj:`float`, otherwise they will be returned as :obj:`int`.
Default is True.
map_proj (:obj:`int`): Model projection [1=Lambert Conformal,
2=Polar Stereographic, 3=Mercator, 6=Lat-Lon]. Required.
truelat1 (:obj:`float`): True latitude 1. Required for
truelat1 (:obj:`float`): Latitude of true scale 1. Required for
map_proj = 1, 2, 3 (defaults to 0 otherwise).
truelat2 (:obj:`float`): True latitude 2. Optional for
truelat2 (:obj:`float`): Latitude of true scale 2. Optional for
map_proj = 1 (defaults to 0 otherwise).
stand_lon (:obj:`float`): Standard longitude. Required for map_proj =
stand_lon (:obj:`float`): Standard longitude. Required for *map_proj* =
1, 2, 6 (defaults to 0 otherwise).
ref_lat (:obj:`float`): A reference latitude. Required.
@ -570,11 +571,11 @@ def ll_to_xy_proj(latitude, longitude, meta=True, squeeze=True, as_int=True, @@ -570,11 +571,11 @@ def ll_to_xy_proj(latitude, longitude, meta=True, squeeze=True, as_int=True,
known_y (:obj:`float`): The known y-coordinate associated with
*ref_lat*. Required.
pole_lat (:obj:`float`): Pole latitude. Optional for
*map_proj* = 6 (defaults to 90 otherwise).
pole_lat (:obj:`float`): Pole latitude. Required for
*map_proj* = 6 (use 90 for no rotation).
pole_lon (:obj:`float`): Pole longitude. Optional for
*map_proj* = 6 (defaults to 0 otherwise).
pole_lon (:obj:`float`): Pole longitude. Required for
*map_proj* = 6 (use 0 for no rotation).
dx (:obj:`float`): The x spacing in meters at the true latitude.
Required for all map projections.
@ -582,13 +583,13 @@ def ll_to_xy_proj(latitude, longitude, meta=True, squeeze=True, as_int=True, @@ -582,13 +583,13 @@ def ll_to_xy_proj(latitude, longitude, meta=True, squeeze=True, as_int=True,
dy (:obj:`float`) - The y spacing in meters at the true latitude.
Required for *map_proj* = 6 (defaults to 0 otherwise).
latinc (:obj:`float`): Required for *map_proj* = 6. Defined as:
latinc (:obj:`float`): Optional for *map_proj* = 6. Default is:
.. code-block:: python
latinc = (dy*360.0)/2.0/Constants.PI/Constants.WRF_EARTH_RADIUS
loninc (:obj:`float`): Required for *map_proj* = 6. Defined as:
loninc (:obj:`float`): Optional for *map_proj* = 6. Default is:
.. code-block:: python
@ -719,13 +720,13 @@ def xy_to_ll_proj(x, y, meta=True, squeeze=True, map_proj=None, truelat1=None, @@ -719,13 +720,13 @@ def xy_to_ll_proj(x, y, meta=True, squeeze=True, map_proj=None, truelat1=None,
map_proj (:obj:`int`): Model projection [1=Lambert Conformal,
2=Polar Stereographic, 3=Mercator, 6=Lat-Lon]. Required.
truelat1 (:obj:`float`): True latitude 1. Required for
truelat1 (:obj:`float`): Latitude of true scale 1. Required for
map_proj = 1, 2, 3 (defaults to 0 otherwise).
truelat2 (:obj:`float`): True latitude 2. Optional for
truelat2 (:obj:`float`): Latitude of true scale 2. Optional for
map_proj = 1 (defaults to 0 otherwise).
stand_lon (:obj:`float`): Standard longitude. Required for map_proj =
stand_lon (:obj:`float`): Standard longitude. Required for *map_proj* =
1, 2, 6 (defaults to 0 otherwise).
ref_lat (:obj:`float`): A reference latitude. Required.
@ -738,25 +739,25 @@ def xy_to_ll_proj(x, y, meta=True, squeeze=True, map_proj=None, truelat1=None, @@ -738,25 +739,25 @@ def xy_to_ll_proj(x, y, meta=True, squeeze=True, map_proj=None, truelat1=None,
known_y (:obj:`float`): The known y-coordinate associated with
*ref_lat*. Required.
pole_lat (:obj:`float`): Pole latitude. Optional for
*map_proj* = 6 (defaults to 90 otherwise).
pole_lat (:obj:`float`): Pole latitude. Required for
*map_proj* = 6 (use 90 for no rotation).
pole_lon (:obj:`float`): Pole longitude. Optional for
*map_proj* = 6 (defaults to 0 otherwise).
pole_lon (:obj:`float`): Pole longitude. Required for
*map_proj* = 6 (use 0 for no rotation).
dx (:obj:`float`): The x spacing in meters at the true latitude.
Required for *map_proj* = 1, 2, 3 (defaults to 0 otherwise).
Required for all map projections.
dy (:obj:`float`) - The y spacing in meters at the true latitude.
Required for *map_proj* = 6 (defaults to 0 otherwise).
latinc (:obj:`float`): Required for *map_proj* = 6. Defined as:
latinc (:obj:`float`): Optional for *map_proj* = 6. Default is:
.. code-block:: python
latinc = (dy*360.0)/2.0/Constants.PI/Constants.WRF_EARTH_RADIUS
loninc (:obj:`float`): Required for *map_proj* = 6. Defined as:
loninc (:obj:`float`): Optional for *map_proj* = 6. Default is:
.. code-block:: python

9
src/wrf/routines.py

@ -160,8 +160,12 @@ def _undo_alias(alias): @@ -160,8 +160,12 @@ def _undo_alias(alias):
def _check_kargs(var, kargs):
for arg in viewkeys(kargs):
if arg not in _VALID_KARGS[var]:
raise ValueError("'%s' is an invalid keyword "
"argument for '%s'" % (arg, var))
if var != "default":
raise ValueError("'{}' is an invalid keyword "
"argument for '{}'".format(arg, var))
else:
raise ValueError("'{}' is an invalid keyword "
"argument".format(arg))
def getvar(wrfin, varname, timeidx=0,
@ -277,6 +281,7 @@ def getvar(wrfin, varname, timeidx=0, @@ -277,6 +281,7 @@ def getvar(wrfin, varname, timeidx=0,
wrfin = get_iterable(wrfin)
if is_standard_wrf_var(wrfin, varname) and varname != "Times":
_check_kargs("default", kwargs)
return extract_vars(wrfin, timeidx, varname,
method, squeeze, cache, meta, _key)[varname]
elif varname == "Times":

Loading…
Cancel
Save