[ncl-talk] HELP With NCL Script For A Cross-Sectional Slice
Kerwyn Texeira
ktish86 at gmail.com
Wed Aug 24 22:36:52 MDT 2016
Hi ncl-talk,
I'm having issues with my script. I'm trying to plot a cross-sectional
slice with a north to south latitude 36 to 40 at longitude -119.5. When I
run the script before ur_plane (where I specify the slice at -119.5) I do
not get any errors. PS. This is a re-gridded wrf script. I have to
re-grid it in order to plot the ageostrophic winds using the z2goeuv
function. Thank you very much in advance for your help. It will be
greatly appreciated.
I'm trying to do an ageostrophic circulation cross-section;
I'm getting the following error/s:
fatal:The result of the conditional expression yields a missing value. NCL
can not determine branch, see ismissing function
fatal:["Execute.c":8578]:Execute: Error occurred at or near line 347 in
file $NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl
My Script:
;======================================================================
; ESMF_regrid.ncl
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/esmf/ESMF_regridding.ncl"
;---Specify method to be used
InterpMethod= "patch"
;---Input file
srcDirName = "./"
srcFileName = "wrfout_d01_2014-01-11_13:00:00.nc"
srcFilePath = srcDirName + srcFileName
;---Wgt File: WRF to Rectilinear
wgtDirName = "./"
wgtFileName = "WRF_to_Rect.WgtFile_"+InterpMethod+".nc"
wgtFilePath = wgtDirName + wgtFileName
;---Retrieve either one level, or all levels. Use '-1' for all.
sfile = addfile(srcFilePath,"r")
ua = wrf_user_getvar(sfile,"ua",0) ; On mass grid
va = wrf_user_getvar(sfile,"va",0)
z = wrf_user_getvar(sfile,"z", 0)
p = wrf_user_getvar(sfile,"pressure", 0)
printVarSummary(ua) ;
(Time,bottom_top,south_north,west_east)
printVarSummary(va) ;
(Time,bottom_top,south_north,west_east)
printVarSummary(z)
printVarSummary(p)
;---Regrid the wind components to a rectilinear grid
ur = ESMF_regrid_with_weights(ua,wgtFilePath,False)
vr = ESMF_regrid_with_weights(va,wgtFilePath,False)
zr = ESMF_regrid_with_weights(z,wgtFilePath, False)
press = ESMF_regrid_with_weights(p,wgtFilePath,False)
printVarSummary(ur)
printVarSummary(vr)
printVarSummary(zr)
printVarSummary(press)
;---Compute the geostrophic winds on the rectilinear grid
lat2d = sfile->XLAT(0,:,:) ; (south_north,west_east)
lon2d = sfile->XLONG(0,:,:)
;---Generate the same rectilinear grid used to generate the weight file
dims = dimsizes(lat2d)
nlat = dims(0)
nlon = dims(1)
lat = fspan(min(lat2d), max(lat2d) ,nlat)
lon = fspan(min(lon2d), max(lon2d) ,nlon)
;---Calculate the geostrophic winds on a rectilinear grid
uv = z2geouv(zr, lat, lon, 1)
printVarSummary(uv)
print("uv: min="+min(uv)+" max="+max(uv))
;----Calculate the geostrophic u wind component on a rectilinear grid
u = uv(0,:,:,:)
printVarSummary(u)
print("u: min="+min(u)+" max="+max(u))
;----Calculate the geostrophic v wind component on a rectinlinear grid
v = uv(1,:,:,:)
printVarSummary(v)
print("v:min="+min(v)+" max="+max(v))
;---Calculate the u real wind comonent
;----------------------------------------------------------------------
opt = True
plane = (/-119.5, 40.0 , -119.5, 36.0/)
ur_plane = wrf_user_intrp3d(ur, press, "v", plane, 0., opt)
; vr_plane = wrf_user_intrp3d(vr, press, "v", plane, 0., opt)
; u_plane = wrf_user_intrp3d(u, press, "v", plane, 0., opt)
; v_plane = wrf_user_intrp3d(v, press, "v", plane, 0., opt)
;uageo = ur_plane - u_plane
;vageo = vr_plane - v_plane
; create plots: Note some defaults chaanged in NCL v6.1.0
;************************************************
wks_type = "png"
wks_type at wkWidth = 2500
wks_type at wkHeight = 2500
wks = gsn_open_wks("png","ESMF")
gsn_define_colormap(wks,"matlab_jet") ; this is the default v6.1.0
onward
res = True
res at gsnDraw = False ; don't draw
res at gsnFrame = False ; don't advance frame
res at gsnAddCyclic = False ; regional data
; res at cnInfoLabelOn = False ; turn off cn info label
res at cnFillOn = False ; turn on color
;res at cnFillMode = "RasterFill"
res at cnLinesOn = False
res at cnLineLabelsOn = False
res at lbLabelBarOn = False ; turn off individual cb's
res at vcLineArrowThicknessF = 7.0
res at vcRefMagnitudeF = 10
res at vcRefLengthF = 0.018
res at gsnLeftString = ""
res at gsnRightSting = ""
res at vcGlyphStyle = "LineArrow"
res at vcMinDistanceF = 0.05
res at vcRefAnnoOn = False
; res at cnLevelSelectionMode = "ManualLevels"
; res at cnMinLevelValF =
; res at cnMaxLevelValF =
; res at cnLevelSpacingF =
; res at mpMinLatF = min(lat2d) ; range to zoom in on
; res at mpMaxLatF = max(lat2d)
; res at mpMinLonF = min(lon2d)
; res at mpMaxLonF = max(lon2d)
;ageo = gsn_csm_vector(wks, uageo, vageo, res);
;draw(ageo)
;frame(wks)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Variables outputs:
Variable: ua
Type: float
Total Size: 2690400 bytes
672600 values
Number of Dimensions: 3
Dimensions and sizes: [bottom_top | 50] x [south_north | 118] x
[west_east | 114]
Coordinates:
Number Of Attributes: 6
FieldType : 104
MemoryOrder : XYZ
description : x-wind component
units : m s-1
stagger :
coordinates : XLONG XLAT
Variable: va
Type: float
Total Size: 2690400 bytes
672600 values
Number of Dimensions: 3
Dimensions and sizes: [bottom_top | 50] x [south_north | 118] x
[west_east | 114]
Coordinates:
Number Of Attributes: 6
FieldType : 104
MemoryOrder : XYZ
description : y-wind component
units : m s-1
stagger :
coordinates : XLONG XLAT
Variable: z
Type: float
Total Size: 2690400 bytes
672600 values
Number of Dimensions: 3
Dimensions and sizes: [bottom_top | 50] x [south_north | 118] x
[west_east | 114]
Coordinates:
Number Of Attributes: 6
FieldType : 104
MemoryOrder : XYZ
description : Height
units : m
stagger :
coordinates : XLONG XLAT
Variable: p
Type: float
Total Size: 2690400 bytes
672600 values
Number of Dimensions: 3
Dimensions and sizes: [bottom_top | 50] x [south_north | 118] x
[west_east | 114]
Coordinates:
Number Of Attributes: 6
coordinates : XLONG XLAT
stagger :
units : hPa
description : Pressure
MemoryOrder : XYZ
FieldType : 104
Variable: ur
Type: float
Total Size: 2690400 bytes
672600 values
Number of Dimensions: 3
Dimensions and sizes: [bottom_top | 50] x [lat | 118] x [lon | 114]
Coordinates:
lat: [17.94702911376953..57.1823844909668]
lon: [-150.7183532714844..-89.28164672851562]
Number Of Attributes: 8
_FillValue : 9.96921e+36
FieldType : 104
MemoryOrder : XYZ
description : x-wind component
units : m s-1
stagger :
remap : remapped via ESMF_regrid_with_weights: Bilinear remapping
missing_value : 9.96921e+36
Variable: vr
Type: float
Total Size: 2690400 bytes
672600 values
Number of Dimensions: 3
Dimensions and sizes: [bottom_top | 50] x [lat | 118] x [lon | 114]
Coordinates:
lat: [17.94702911376953..57.1823844909668]
lon: [-150.7183532714844..-89.28164672851562]
Number Of Attributes: 8
_FillValue : 9.96921e+36
FieldType : 104
MemoryOrder : XYZ
description : y-wind component
units : m s-1
stagger :
remap : remapped via ESMF_regrid_with_weights: Bilinear remapping
missing_value : 9.96921e+36
Variable: zr
Type: float
Total Size: 2690400 bytes
672600 values
Number of Dimensions: 3
Dimensions and sizes: [bottom_top | 50] x [lat | 118] x [lon | 114]
Coordinates:
lat: [17.94702911376953..57.1823844909668]
lon: [-150.7183532714844..-89.28164672851562]
Number Of Attributes: 8
_FillValue : 9.96921e+36
FieldType : 104
MemoryOrder : XYZ
description : Height
units : m
stagger :
remap : remapped via ESMF_regrid_with_weights: Bilinear remapping
missing_value : 9.96921e+36
Variable: press
Type: float
Total Size: 2690400 bytes
672600 values
Number of Dimensions: 3
Dimensions and sizes: [bottom_top | 50] x [lat | 118] x [lon | 114]
Coordinates:
lat: [17.94702911376953..57.1823844909668]
lon: [-150.7183532714844..-89.28164672851562]
Number Of Attributes: 8
_FillValue : 9.96921e+36
stagger :
units : hPa
description : Pressure
MemoryOrder : XYZ
FieldType : 104
remap : remapped via ESMF_regrid_with_weights: Bilinear remapping
missing_value : 9.96921e+36
Variable: uv
Type: float
Total Size: 5380800 bytes
1345200 values
Number of Dimensions: 4
Dimensions and sizes: [2] x [50] x [118] x [114]
Coordinates:
Number Of Attributes: 1
_FillValue : 9.96921e+36
(0) uv: min=-69.4722 max=81.5316
Variable: u
Type: float
Total Size: 2690400 bytes
672600 values
Number of Dimensions: 3
Dimensions and sizes: [50] x [118] x [114]
Coordinates:
Number Of Attributes: 1
_FillValue : 9.96921e+36
(0) u: min=-27.5434 max=81.5316
Variable: v
Type: float
Total Size: 2690400 bytes
672600 values
Number of Dimensions: 3
Dimensions and sizes: [50] x [118] x [114]
Coordinates:
Number Of Attributes: 1
_FillValue : 9.96921e+36
(0) v:min=-69.4722 max=75.5611
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20160824/482648a8/attachment.html
More information about the ncl-talk
mailing list