[ncl-talk] FW: Difficulty with cross-section plot

Black, Forrest (LARC-D318)[UNIVERSITIES SPACE RESEARCH ASSOCIATION] forrest.black at nasa.gov
Mon Apr 24 11:04:21 MDT 2017


Hi Alan,

Sorry for the ambiguity and messy code. Using “copy_VarCoords” was just the function I was looking for and now it works.

Thank you for your help.


-        Forrest

From: Alan Brammer [mailto:abrammer at albany.edu]
Sent: Monday, April 24, 2017 12:24 PM
To: Black, Forrest (LARC-D318)[UNIVERSITIES SPACE RESEARCH ASSOCIATION] <forrest.black at nasa.gov>
Cc: ncl-talk at ucar.edu
Subject: Re: [ncl-talk] FW: Difficulty with cross-section plot

ignoring the initial ambiguous section in your code.
(  Whats going on between lines 36 - 46.   As is, it fails, and then it seems like you overwrite it anyway.  )


Your problem is a simple lack of metadata.

       ws = sqrt(u^2 + v^2)   ; Calculate Windspped
This doesn’t copy over any meta data so ws is a 3d array but with no coordinates. Therefore gsn_csm_pres_hgt() doesn’t know what to do it.

    ws = sqrt(u^2 + v^2)   ; Calculate Windspped
    copy_VarCoords(u, ws)
    var=ws


The printVarSummary(ws) you had commented out, should have revealed the lack of metadata on this variable.
Now ws and subsequently var has all the necessary metadata the gsn_csm plots can work out what they’re doing.  The error text is more specific than it needs to be.  Your problem is the lack of any coordinate, attaching the coordinate “lv_ISBL0” will work fine.



Good luck,

Alan






##############################
Alan Brammer,
Post-Doc Researcher

Department of Atmospheric and Environmental Sciences,
University at Albany, State University of New York, Albany, NY, 12222
abrammer at albany.edu<mailto:abrammer at albany.edu>
##############################

On 24 Apr 2017, at 11:43, Black, Forrest (LARC-D318)[UNIVERSITIES SPACE RESEARCH ASSOCIATION] <forrest.black at nasa.gov<mailto:forrest.black at nasa.gov>> wrote:

Hello,

I am trying to plot a cross-section plot of wind-speed using NCL version 6.3.0.
The attached script is modified from an example found at http://www.ncl.ucar.edu/Applications/height_long.shtml - example “narr_6.ncl<http://www.ncl.ucar.edu/Applications/Scripts/narr_6.ncl>”.

The error message I keep getting is:

(0)     gsn_csm_pres_hgt: Fatal: The first dimension of the input data must
(0)     have a coordinate variable called 'lev.'
(0)     Cannot create plot.
fatal:Illegal right-hand side type for assignment
fatal:["Execute.c":8575]:Execute: Error occurred at or near line 132 in file wind_speed_profile.ncl

It seems that although the variable I am using has pressure level data (in Pa units), the leftmost dimension is not specifically named “lev”.

Any suggestions suggestion on how to get around  this error would be greatly appreciated.

The grib2 file I am using is too large to attach, but a similar one can be found at ftp://nomads.ncdc.noaa.gov/RUC/13km/201702/20170201/rap_130_20170201_0000_000.grb2

Thank you,

-        Forrest
<wind_speed_profile.ncl>_______________________________________________
ncl-talk mailing list
ncl-talk at ucar.edu<mailto: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/20170424/a86d9743/attachment.html 


More information about the ncl-talk mailing list