[ncl-talk] NCL plot problem with ascii data

Dennis Shea shea at ucar.edu
Fri Apr 5 05:55:25 MDT 2019


I used NCL 6.5.0 The oldest version of NCL that I have available is 6.3.0
[4+ years old].

The script runs on both versions. There is no way to retrofit to an old
version.

%> ncl -V
%> uname -a

will provide useful information

Ypu must post installation questions to the ncl-install at ucar.edu to which
you must subscribe. See

*http://www.ncl.ucar.edu/Support/email_lists.shtml*
<http://www.ncl.ucar.edu/Support/email_lists.shtml>

I do not help with installation questions.

Good luck


On Thu, Apr 4, 2019 at 9:13 PM MM Ali <mmali110 at gmail.com> wrote:

> Hello Dennis,
>
> Thank you very much for your elaborate explanation and particularly for
> correcting my manuscript. When I ran the edited code, I get the following
> error:
>
> fatal:Cannot create triangular mesh: supply additional resources or build
> with Triangle package
> fatal:ContourPlotDraw: draw error
> fatal:ContourPlotDraw: draw error
> fatal:PlotManagerDraw: error in plot draw
> fatal:_NhlPlotManagerDraw: Draw error
> fatal:Cannot create triangular mesh: supply additional resources or build
> with Triangle package
> fatal:ContourPlotDraw: draw error
> fatal:ContourPlotDraw: draw error
> fatal:PlotManagerDraw: error in plot draw
> fatal:_NhlPlotManagerDraw: Draw error
>
> Please suggest the changes in the code.
>
> Best regards
> Ali
>
> On Fri, Apr 5, 2019 at 5:44 AM Dennis Shea <shea at ucar.edu> wrote:
>
>> 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
>>>
>>
>
> --
> *Dr. MM Ali*
> Formerly:
> Scientist G & Group Director
> NRSC/ISRO
> email: mmali110 at gmail.com
>            mmali at coaps.fsu.edu
> Mob: +91 9949045110
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20190405/e8a0aadf/attachment.html>


More information about the ncl-talk mailing list