[ncl-talk] where am I getting wrong in plotting the values please help....

Mary Haley haley at ucar.edu
Tue May 30 10:34:16 MDT 2017


I think you need to look at your data more closely.

My guess is that YCells and XCells are not actually lat / lon arrays, but
yet you are trying to use them to plot your data over a map.

You have this code, which looks like you were trying to get NCL to
recognize YCells and XCells as lat/lon arrays:

lat = uf->u&YCells
lon = uf->v&XCells

u!0="lat"
u!1="lon"

u&lat at units="degrees_north"
u&lon at units="degrees_east"

However, I'm suspicious that YCells and XCells actually represent the
latitude and longitude values of your array.

​It helps if you use "printVarSummary" to look at your data before you plot
it:

printVarSummary(u)

The above should also print the numeric range of the lat / lon arrays, and
you will see very quickly whether they actually look like lat / lon values.


Variable : u Type : float . . . Number of Dimensions: 2 Dimensions and
sizes: [lat | *some number*] x [lon | *some number*] *Coordinates:
lat: [**...you'll
see a numeric range here...**] lon: [**...ditto...**]* Number Of Attributes:

If u has an attribute called "coordinates", then it is very important to
pay attention to this because this will likely tell you what the name is of
your lat/lon arrays on the file, which you will need to use to replace
"YCells" and "XCells". It would look something like this:

Variable : u Type : float . . . Number of Dimensions: 2 Dimensions and
sizes: [lat | *some number*] x [lon | *some number*] *Coordinates:
lat: [**...you'll
see a numeric range here...**] lon: [**...ditto...**]* Number Of
Attributes: 5 *coordinates*: "latitude longitude"


Important note: the "coordinates" attribute is a different thing than
"Coordinates", which you *always* see when you do a printVarSummary.  The
"Coordinates" output from printVarSummary represents coordinate *arrays*
that may already be attached to your file.

If you do see a "coordinates" attribute, then make note of the names in the
attribute, then do an "ncl_filedump" on your file on the UNIX command line
to see if your file contains variables with these names.  If it does, then
you can replace this code:

lat = uf->u&YCells
lon = uf->v&XCells

u!0="lat"
u!1="lon"

u&lat at units="degrees_north"
u&lon at units="degrees_east"

with:

u!0="lat"
u!1="lon"
u&lat := uf->latitude     ; The ":=" forces YCell and XCell to be
overwritten, in case
u&lon := uf->longitude    ; they are different types than latitude and
longitude.

You need to do the same for "v":

v!0="lat"
v!1="lon"
v&lat = vf->latitude
v&lon = vf->longitude
​
If the above doesn't work, then it would help if you could email ncl-talk
and provide the output from doing an "ncl_filedump" on uwind500.nc.

​--Mary
​


On Tue, May 30, 2017 at 3:36 AM, gurbrinder aulakh <
gurbrinderaulakh at yahoo.co.in> wrote:

> I want to compute wind divergence reading u and v wind components but I am
> getting the following warnings when I run the script.Plot is also not as
> expected... Please help tried everything from the earlier queries but not
> finding any solution.... Am I reading the correct values....Thanks in
> advance..
>
>
>
>
> warning:IrTransInitialize: trYCoordPoints contains invalid coordinate
> array: defaulting trYAxisType to LinearAxis
> warning:AutoComputeMajorTickMarks: min and max are so close together or
> so far apart that arithmetic error may cause problems, proceed at own risk
> warning:ComputeMinorTickMarks: The distance between major tickmarks is so
> close or so far apart that arithmetic error may cause problems determining
> the accurate locations of minor tickmarks
> warning:AutoComputeMajorTickMarks: min and max are so close together or
> so far apart that arithmetic error may cause problems, proceed at own risk
> warning:ComputeMinorTickMarks: The distance between major tickmarks is so
> close or so far apart that arithmetic error may cause problems determining
> the accurate locations of minor tickmarks
> warning:StreamlinePlotInitialize: coordinate spacing is irregular; linear
> spacing only possible using index coordinates for Y Axis
> warning:IrTransInitialize: trYCoordPoints contains invalid coordinate
> array: defaulting trYAxisType to LinearAxis
>
>
>
>
>
> *************************************************
> ;
> ; These files are loaded by default in NCL V6.2.0 and newer
> ; load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
> ; load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
> ; load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
> ;*************************************************
> begin
>
>   uf = addfile("uwind500.nc","r")
>     vf = addfile("vwind500.nc","r")
>
>      u   = uf->UGRD_500_ISBL(0,:,:)
>     v   = vf->VGRD_500_ISBL(0,:,:)
>
> lat = uf->u&YCells
>     lon = uf->v&XCells
>
> u!0="lat"
> u!1="lon"
>
> u&lat at units="degrees_north"
> u&lon at units="degrees_east"
>
> printVarSummary(u);
>   div = uv2dvG_Wrap(u,v)                ; u,v ==> divergence
>
>   dv2uvg(div,u,v) ; div  ==> divergent  wind components
>
>
>  u at long_name  = "Zonal Divergent Wind"
>   u at units      = u at units
>   v at long_name  = "Meridional Divergent Wind"
>   v at units      = v at units
>
> ;*************************************************
> ; plot results
> ;*************************************************
>   wks  = gsn_open_wks("png","wind123")           ; send graphics to PNG
> file
>
>   res                 = True
>   res at vcRefMagnitudeF = 3.                    ; make vectors larger
>   res at vcRefLengthF    = 0.050                 ; reference vector length
>   res at vcGlyphStyle    = "CurlyVector"         ; turn on curly vectors
>   res at vcMinDistanceF  = 0.012                 ; thin the vectors
>
>   res at gsnLeftString   = "Divergent Wind"
>                                               ; plot 1st time step
>   plot= gsn_csm_vector_map(wks,u(:,:),v(:,:),res)
>
> end
>
>
> _______________________________________________
> 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/20170530/5cb3be10/attachment.html 


More information about the ncl-talk mailing list