[ncl-talk] NCL plot problem with ascii data
Dennis Shea
shea at ucar.edu
Thu Apr 4 18:14:41 MDT 2019
As ncl-talk always mentions: The 1st rule of data processing is: *Look at
your data!*
[1]
The data look like they are sub-sampled from a gridded dataset. Given the
distribution of the locations, I would call this a 'ragged-2d-array.'
Specifically: each latitude has a different number of points; each
longitude has a different number of points. See plots.
[2]
Due to the ordering of the values on the ascii file, coordinate value
syntax [ *&* ] should not be used. Specifically, the latitude and longitude
values are not monotonic which is a requirement for coordinate arrays.
[3]
The the values are between 100E and 70W. For a limited region, I find is
easier in this instance to use all positive longitudes [or all negative
longitudes]. Hence, I changed a longitude range of 100 to 290.
longitude = *where*
<http://www.ncl.ucar.edu/Document/Functions/Built-in/where.shtml>(longitude.lt.0,
longitude+360, longitude)
[4]
For graphics, NCL requires ragged arrays to be treated as an array of
random locations [eg: station data].
res*@*sfXArray = longitude ; data values are irregularly spaced
res*@*sfYArray = latitude
[5]
The *gsn_coordinates* graphics utility which plot markers at each location
requires that the 1d latitude/longitude be attributes to the variable being
plotted:
variable*@lon1d* = longitude
variable*@lat1d* = latitude
* gsn_coordinates
<http://www.ncl.ucar.edu/Document/Graphics/Interfaces/gsn_coordinates.shtml>*(wks,contour,variable,mkres)
[6]
The plots alternate between *cnFillMode*
<http://www.ncl.ucar.edu/Document/Graphics/Resources/cn.shtml#cnFillMode>
using the default cnFillMode="AreaFill" and cnFillMode="RasterFill"
In this case, I suggest cnFillMode="RasterFill"
[7] For values that span 0.0, color palettes with *White-in-the-middle*
<http://www.ncl.ucar.edu/Document/Graphics/color_table_gallery.shtml> work
best
======
*%> ncl* MMali.ncl
=====
Good luck
On Thu, Apr 4, 2019 at 10:06 AM Toni Klemm <toni-klemm at tamu.edu> wrote:
> Hi Ali,
>
> I had this problem before. Since you extracted lat and lon data from
> ASCII, it might be that your data doesn’t have metadata information
> attached that tells NCL what it is (i.e., latitudes and longitudes).
> Without that it is just a bunch of numbers for NCL. You can add this
> metadata by adding this to your code after you extract your latitude and
> longitude variables:
>
> latitude!0 = "lat"
> latitude&lat = lat
> latitude at long_name = "latitude"
> latitude at units = "degrees_north"
>
> longitude!0 = "lon"
> longitude&lon = lon
> longitude at long_name = "longitude"
> longitude at units = "degrees_east"
>
> Hope that helps,
> Toni
>
>
>
> *Toni Klemm, Ph.D.*Postdoctoral Research Associate
> Department of Ecosystem Science and Management
> College of Agriculture and Life Sciences
> Texas A&M University, College Station, TX
> Contributor to the Early Career Climate Forum <http://www.eccforum.org>
> www.toni-klemm.de | @toniklemm <http://twitter.com/toniklemm>
>
>
>
>
>
>
>
>
> On Apr 4, 2019, at 2:00 AM, MM Ali <mmali110 at gmail.com> wrote:
>
> Hi,
>
> I modified the ce_3.ncl code to read the ascii data. Data and the modified
> ncl code are attached. The variables in the data are dummy, latitude,
> longitude, variable, dummy2. I get the following errors
>
> (0) check_for_y_lat_coord: Warning: Data either does not contain
> (0) a valid latitude coordinate array or doesn't contain one at all.
> (0) A valid latitude coordinate array should have a 'units'
> (0) attribute equal to one of the following values:
> (0) 'degrees_north' 'degrees-north' 'degree_north' 'degrees north'
> 'degrees_N' 'Degrees_north' 'degree_N' 'degreeN' 'degreesN' 'deg north'
> (0) check_for_lon_coord: Warning: Data either does not contain
> (0) a valid longitude coordinate array or doesn't contain one at all.
> (0) A valid longitude coordinate array should have a 'units'
> (0) attribute equal to one of the following values:
> (0) 'degrees_east' 'degrees-east' 'degree_east' 'degrees east'
> 'degrees_E' 'Degrees_east' 'degree_E' 'degreeE' 'degreesE' 'deg east'
> (0) Error: scalar_field: If the input data is 1-dimensional, you must
> set sfXArray and sfYArray to 1-dimensional arrays of the same length.
> warning:create: Bad HLU id passed to create, ignoring it
>
> Please help. It would be great if the necessary corrections are made to
> the code (I am just a few days old for NCL, though 66+ years old!)
> Thanks
> Ali
> *Dr. MM Ali*
> Formerly:
> Scientist G & Group Director
> NRSC/ISRO
> email: mmali110 at gmail.com
> mmali at coaps.fsu.edu
> Mob: +91 9949045110
> <may.txt><ce3.ncl>_______________________________________________
> ncl-talk mailing list
> ncl-talk at ucar.edu
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
>
> _______________________________________________
> 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/20190404/2a9b0585/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: MMali.ncl
Type: application/octet-stream
Size: 3903 bytes
Desc: not available
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20190404/2a9b0585/attachment-0001.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: MM_ali.000001.png
Type: image/png
Size: 131532 bytes
Desc: not available
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20190404/2a9b0585/attachment-0005.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: MM_ali.000002.png
Type: image/png
Size: 69755 bytes
Desc: not available
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20190404/2a9b0585/attachment-0006.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: MM_ali.000003.png
Type: image/png
Size: 189161 bytes
Desc: not available
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20190404/2a9b0585/attachment-0007.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: MM_ali.000004.png
Type: image/png
Size: 69940 bytes
Desc: not available
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20190404/2a9b0585/attachment-0008.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: MM_ali.000005.png
Type: image/png
Size: 230897 bytes
Desc: not available
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20190404/2a9b0585/attachment-0009.png>
More information about the ncl-talk
mailing list