[ncl-talk] Calculating Velocity Potential (problem with saving output)
Lyndon Mark Olaguera
olagueralyndonmark429 at gmail.com
Thu Jan 5 01:34:38 MST 2017
Dear All,
I'm trying to calculate the velocity potential (fixed grid) at 200 hPa from
NCEP daily reanalysis data. I am using the uv2sfvpF(u,v) function.
I am having trouble in saving the output to a netcdf file. How do I save
the calculated velocity potential with the same grid coordinates (i.e. same
lat order as the original file) as the original file?
I attached the link of the files that I'm working with and the script in
this email.
I highlight in red the line where I got stuck.
I'll appreciate any help.
Many thanks,
Lyndz
Here's my script:
;****************************************************
;This script calculates the velocity potential
;Input: U and V wind components
;****************************************************
begin
ufile = addfile("uwind200hPa_1975.nc","r")
vfile = addfile("vwind200hPa_1975.nc","r")
uwnd = ufile->uwnd(:,:,::-1,:) ;sort coordinates usinf ::-1
printVarSummary(uwnd)
vwnd = vfile->vwnd(:,:,::-1,:) ;sort coordinates using ::-1
printVarSummary(vwnd)
sfvp = uv2sfvpF(uwnd,vwnd)
sfvp = (/sfvp/1e6/) ;rescaling by 1e6
*copy_VarCoords(ufile,vp)*
vp at long_name = "velocity potential"
vp at units = "m/s"
ncdf = addfile("test.nc" ,"c") ; open output netCDF file
fAtt = True ; assign file attributes
fAtt at title = "Velocity Potential"
fAtt at source_file = "
https://www.esrl.noaa.gov/psd/data/gridded/data.ncep.reanalysis.pressure.html
"
fAtt at Conventions = "None"
fAtt at creation_date = systemfunc ("date")
fileattdef( ncdf, fAtt ) ; copy file attributes
ncdf->vp = vp
end
Here's the link to the files:
https://drive.google.com/drive/folders/0B9faET7Bc2o8MmtGS2VJLTB2NE0?usp=sharing
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20170105/de2b3340/attachment.html
-------------- next part --------------
A non-text attachment was scrubbed...
Name: chi.ncl
Type: application/octet-stream
Size: 999 bytes
Desc: not available
Url : http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20170105/de2b3340/attachment.obj
More information about the ncl-talk
mailing list