[ncl-talk] Plotting a variable's isosurface in 3D by tdez3d

Armağan Gözütok armagango at gmail.com
Mon Dec 11 23:33:23 MST 2017


Hello Mary,

Thank you for the reply and helpful recommendations, I could manage to plot
some 4D variables in 3D by NCL, as WRF model has mixing ratio output
parameters like q_cloud, q_ice, q_vapor, q_snow, q_rain, q_hail, q_graupel
& so on.

The error I was getting the first was a dimension error, in terms of the
order in tdez3d function's 3d axis parameters (x,y,z), managed to solve the
order problem by some modifications. Correct order is kind of like this for
WRF default i/o, z -> vertical level, x -> latitude, y -> longitude:

tdez3d(wks,zi,xi,yi,qcloud,ui, rho, theta, phi,4)

I had also tried out plotting these variables in R & VAPOR too. I include
the R & NCL plots in the attachment for the control & comparison. I first
tried some radar maximum reflection-like plot for corresponding rain &
cloud mixing ratio in R, the red surfaces have higher isosurface values
while the greens are likely the lowest isosurface values. The green colors
represent the green isosurface plotted by R with same isosurface value.

The camera orientation are from the western looks of the domain, I am
currently at this point to correct axes locations, intervals and some
better visual interpretation perception maybe. This code I am including
will generate a cloud mixing ratio visualization without errors, and
without axis or envelope box around the domain, I defined tdlbls() input
arguments however the plot did not generate anything other than q_cloud
isosurface.

begin

a = addfile("wrfout_d01_2017-07-27_12:00:00.nc","r")

qcloud = a->QCLOUD(50,:,:,:) ; Cloud mixing ratio at iteration #49
lat = a->XLAT(0,:,0) ; latitude
lon = a->XLONG(0,0,:) ; longitude

xi = -lat
yi = -lon
zi = -ispan(1,49,1)*0.1 ;vertical pressure level #
ui = 0.00000005 ; graupel mixing ratio defined for isosurface plot


dimlat = dimsizes(lat)
dimlon = dimsizes(lon)
dimz = dimsizes(zi)
dimqcloud = dimsizes(qcloud)

print(dimlat)
print(dimlon)
print(dimz)
print(dimqcloud)

rho = 2.
theta = -0.
phi = -30.



znlb = " "
xnlb = " 24 25 26 27 28 29 30 31 32"
ynlb = " 38 39 40 41 42 43 44 45 "

zilb = "Z Coordinate Values"
xilb = "Latitude Coordinate Values"
yilb = "Longitude Coordinate Values"

zmin = min(zi)
xmin = min(xi)
ymin = min(yi)
zmax = max(zi)
xmax = max(xi)
ymax = max(yi)

wks = gsn_open_wks("png","3d_isosurface_qcloud")

tdlbls (wks,(/zmin,xmin,ymin/),(/zmax,xmax,ymax/), \
(/znlb,xnlb,ynlb/),(/zilb,xilb,yilb/),1)

tdez3d(wks,zi,xi,yi,qcloud,ui, rho, theta, phi,4)

frame(wks)


end

Thanks for the help & best wishes.

2017-12-11 22:37 GMT+03:00 Mary Haley <haley at ucar.edu>:

> Armagan,
>
> In general, we recommend that people not use our 3D plotting package, as
> it is rather old and not anywhere near as developed as other free packages
> out there.
>
> If you are trying to plot WRF data in 3D, then I recommend VAPOR, which is
> tailored for plotting WRF data in 3D:
>
> https://www.vapor.ucar.edu
>
> If you really need to use TDEZ3D for other reasons, then please include
> the full error message you're getting from NCL.
>
> Thanks,
>
> --Mary
>
>
> On Sat, Dec 9, 2017 at 8:16 AM, Armağan Gözütok <armagango at gmail.com>
> wrote:
>
>> Hello,
>>
>> I wanted to create 3d plots recently, bye some modification on the
>> scripts here:
>> https://www.ncl.ucar.edu/Applications/tdpack.shtml
>>
>> I did manage to plot the surface plots by tdez2d function (plotted HGT
>> from the WRF outputs), however my 3d variables cannot be plotted, getting
>> always an error somehow although i check all the dimensions properly which
>> they coincide.
>>
>> I couldn't manage to upload an .nc outputs to the ftp server,
>>
>>
>> Here is my NCL script to create isosurface plot of graupel mixing ratio
>> (called isosurf.ncl) different than 3d_hgt.ncl:
>>
>>
>> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
>>
>> begin
>>
>>   a = addfile("wrfout_d01_2017-07-27_12:00:00.nc","r")
>>
>>   qgraup = a->QGRAUP(49,:,:,:)                 ; Graupel mixing ratio at
>> iteration #49
>>   lat = a->XLAT(0,:,0)                ; latitude
>>   lon = a->XLONG(0,0,:)               ; longitude
>>
>>   xi = lat
>>   yi = lon
>>   zi = ispan(1,49,1)*1. ;vertical pressure level # 50 different pressure
>> levels
>>   ui = 0.0001 ; graupel mixing ratio defined for isosurface plot
>>
>>
>>   ;dimlat = dimsizes(lat)
>>   ;dimlon = dimsizes(lon)
>>   dimz = dimsizes(zi)
>>   ;dimgraup = dimsizes(qgraup)
>>
>>   ;print(dimlat)
>>   ;print(dimlon)
>>   print(dimz)
>>   ;print(dimgraup)
>>
>>
>>   wks = gsn_open_wks("png","3d_isosurface_qgraup")
>>
>>   tdez3d(wks,xi,yi,zi,qgraup,ui,1.8,-45.,58.,-4)
>>
>>   frame(wks)
>>
>> end
>>
>>
>> Armagan
>>
>>
>>
>> _______________________________________________
>> ncl-talk mailing list
>> ncl-talk at ucar.edu
>> List instructions, subscriber options, unsubscribe:
>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20171212/330998b3/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: qcloud_goddard.png
Type: image/png
Size: 321067 bytes
Desc: not available
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20171212/330998b3/attachment-0002.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: qrain_goddard.png
Type: image/png
Size: 227164 bytes
Desc: not available
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20171212/330998b3/attachment-0003.png>


More information about the ncl-talk mailing list