Browse Source

Changed default missing value to the one from netcdf.h that NCL uses

main
Bill Ladwig 10 years ago
parent
commit
a44dd47892
  1. 4
      wrf_open/var/src/python/wrf/var/cape.py
  2. 1
      wrf_open/var/src/python/wrf/var/constants.py
  3. 5
      wrf_open/var/src/python/wrf/var/interp.py

4
wrf_open/var/src/python/wrf/var/cape.py

@ -8,7 +8,7 @@ from wrf.var.util import extract_vars @@ -8,7 +8,7 @@ from wrf.var.util import extract_vars
__all__ = ["get_2dcape", "get_3dcape"]
def get_2dcape(wrfnc, timeidx=0, missing=-999999.0):
def get_2dcape(wrfnc, timeidx=0, missing=Constants.DEFAULT_FILL):
"""Return the 2d fields of cape, cin, lcl, and lfc"""
ncvars = extract_vars(wrfnc, timeidx, vars=("T", "P", "PB", "QVAPOR", "PH",
"PHB", "HGT", "PSFC"))
@ -60,7 +60,7 @@ def get_2dcape(wrfnc, timeidx=0, missing=-999999.0): @@ -60,7 +60,7 @@ def get_2dcape(wrfnc, timeidx=0, missing=-999999.0):
return ma.masked_values(res,missing)
def get_3dcape(wrfnc, timeidx=0, missing=-999999.0):
def get_3dcape(wrfnc, timeidx=0, missing=Constants.DEFAULT_FILL):
"""Return the 3d fields of cape and cin"""
ncvars = extract_vars(wrfnc, timeidx, vars=("T", "P", "PB", "QVAPOR",

1
wrf_open/var/src/python/wrf/var/constants.py

@ -8,6 +8,7 @@ class Constants(object): @@ -8,6 +8,7 @@ class Constants(object):
TCK0 = 273.15
T_BASE = 300.0 # In WRF the base temperature is always 300 (not var T00)
PI = 3.14159265
DEFAULT_FILL = 9.9692099683868690e+36 # Value is from netcdf.h
class ConversionFactors(object):

5
wrf_open/var/src/python/wrf/var/interp.py

@ -5,11 +5,12 @@ import numpy.ma as ma @@ -5,11 +5,12 @@ import numpy.ma as ma
from wrf.var.extension import interpz3d,interp2dxy,interp1d
from wrf.var.decorators import handle_left_iter, handle_casting
from wrf.var.constants import Constants
__all__ = ["interplevel", "vertcross", "interpline"]
# Note: Extension decorator is good enough to handle left dims
def interplevel(data3d,zdata,desiredloc,missingval=-99999):
def interplevel(data3d,zdata,desiredloc,missingval=Constants.DEFAULT_FILL):
"""Return the horizontally interpolated data at the provided level
data3d - the 3D field to interpolate
@ -140,7 +141,7 @@ def _get_xy(xdim, ydim, pivot_point=None, angle=None, @@ -140,7 +141,7 @@ def _get_xy(xdim, ydim, pivot_point=None, angle=None,
ignore_kargs=("missingval", "pivot_point", "angle",
"start_point", "end_point"))
@handle_casting(arg_idxs=(0,1))
def vertcross(data3d, z, missingval=-99999,
def vertcross(data3d, z, missingval=Constants.DEFAULT_FILL,
pivot_point=None,angle=None,
start_point=None,end_point=None):
"""Return the vertical cross section for a 3D field, interpolated

Loading…
Cancel
Save