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

Lyndon Mark Olaguera olagueralyndonmark429 at gmail.com
Thu Jan 5 18:11:48 MST 2017


Dear Mary,

I corrected my script but I still encounter the following errors:

fatal:Subscript out of range, error in subscript #0
fatal:An error occurred reading dfrom
fatal:["Execute.c":8575]:Execute: Error occurred at or near line 190 in
file /usr/local/ncl-6.3.0/lib/ncarg/nclscripts/csm/contributed.ncl
fatal:["Execute.c":8575]:Execute: Error occurred at or near line 20 in file
chi.ncl


Line 20 in the script is the copy_VarCoords(ufile,*vp*).

Any suggestions to properly output this?

Many thanks,

*Lyndz*

On Fri, Jan 6, 2017 at 12:39 AM, Mary Haley <haley at ucar.edu> wrote:

> 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/ps
>> d/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/0B9faET7Bc2o8MmtGS2VJ
>> LTB2NE0?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/20170106/1d9b0f56/attachment.html 


More information about the ncl-talk mailing list