[ncl-talk] Calculating Velocity Potential (problem with saving output)

Mary Haley haley at ucar.edu
Thu Jan 5 08:39:26 MST 2017


Lyndz,

It looks like a simple typo.  You have:

*sfvp* = uv2sfvpF(uwnd,vwnd)
*sfvp* = (/*sfvp*/1e6/)                   ;rescaling by 1e6

copy_VarCoords(ufile,*vp*)

*vp*@long_name = "velocity potential"
*vp*@units     = "m/s"

The variable you're computing is called *sfvp*, but then you refer to *vp*
after that. Change the two *sfvp* lines to be *vp* instead:

*vp* = uv2sfvpF(uwnd,vwnd)
*vp* = (/*vp*/1e6/)                   ;rescaling by 1e6

--Mary


On Thu, Jan 5, 2017 at 1:34 AM, Lyndon Mark Olaguera <
olagueralyndonmark429 at gmail.com> wrote:

> 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
>
> _______________________________________________
> 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/20170105/90270b23/attachment.html 


More information about the ncl-talk mailing list