[ncl-talk] Great! NCL plot problem with ascii data resolved

MM Ali mmali110 at gmail.com
Sat Apr 6 16:45:48 MDT 2019


Dear Dennis,

Really great! It is working now. Thanks a lot. This would be useful to
anyone who uses ASCII data.

NCL users using ASCII data: You can download the script and use it with due
acknowledgments to Dennis.
Thanks once again Dennis. You solved my long pending problem. I admit that
I troubled you a lot!

Best regards
Ali


On Sun, Apr 7, 2019 at 12:22 AM Dennis Shea <shea at ucar.edu> wrote:

> The script you sent reads a variable from a *netCDF* file. The variable
> is on a *regular lat/lon grid*. These types of variables can be plotted *directly
> *as is done in the example you sent.
>
> The variable on the *ascii* file  is  a *'ragged array' *variable*. It
> is  *NOT*  on a regular grid. *Hence, it can not be plotted directly.  Variables
> on ragged-arrays [random data]  can *only* be plotted using the *sfXArray
> *and *sfYArray* graphic resources. I
> *t is the use of these resources that results in NCL calling the
> triangular mesh code. *
>
> ---
>
> I have attached an NCL script that places the values on the text  file
> onto a regular 1x1 grid. Also, optionally, writes these to a netCDF file.
> --
> I am done with this.
>
> Good Luck
>
> On Sat, Apr 6, 2019 at 12:04 AM MM Ali <mmali110 at gmail.com> wrote:
>
>> Unfortunately, the same error comes. On the other hand  the attached
>> ne1.ncl works fine. However, it reads the .nc file NOT the ascii file. The
>> problem looks to be in reading the ASCII file. I am unable to understand
>> where the problem is. Florida State University might have installed
>> everything properly for ASCII data.
>>
>> On Sat, Apr 6, 2019 at 11:24 AM Dennis Shea <shea at ucar.edu> wrote:
>>
>>> Yes. I know.
>>>
>>> The MMali.ncl
>>>
>>> uses sfXArray and sfYArray because toour data is a ragged array. This
>>> invokes the triangular mesh code.
>>>
>>> D
>>>
>>> On Fri, Apr 5, 2019 at 9:54 PM MM Ali <mmali110 at gmail.com> wrote:
>>>
>>>> sorry the load files are not required for version 6.2.0 and newer.
>>>>
>>>> On Fri, Apr 5, 2019 at 10:35 PM MM Ali <mmali110 at gmail.com> wrote:
>>>>
>>>>> Dear Dennis,
>>>>>
>>>>> ncl -V gave  6.5.0
>>>>> and uname -a gave
>>>>>
>>>>> Linux elnino-vm.coaps.fsu.edu 4.19.15-300.fc29.x86_64 #1 SMP Mon Jan
>>>>> 14 16:32:35 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
>>>>>
>>>>> I do not use the linux system directly. I connect my laptop to the
>>>>> system through xming or nxclient. Both give the same error. Since you are
>>>>> able to run in your system having 6.5.0 version, I feel the error I get is
>>>>> because of the xming or nxclient problem. The program creates land filled
>>>>> with gray and the entire ocean portion filled with black. The error is:
>>>>>
>>>>> 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
>>>>> fatal:Cannot create triangular mesh: supply additional resources or
>>>>> build with Triangle package
>>>>> fatal:ContourPlotDraw: draw error
>>>>> fatal:ContourPlotDraw: draw error
>>>>> fatal:ContourPlotDraw: draw error
>>>>> fatal:PlotManagerDraw: error in plot draw
>>>>> fatal:_NhlPlotManagerDraw: Draw error
>>>>>
>>>>> I will be thankful who got a similar problem can help me.
>>>>>
>>>>> On Fri, Apr 5, 2019 at 5:25 PM Dennis Shea <shea at ucar.edu> wrote:
>>>>>
>>>>>> 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
>>>>>>>
>>>>>>
>>>>>
>>>>> --
>>>>> *Dr. MM Ali*
>>>>> Formerly:
>>>>> Scientist G & Group Director
>>>>> NRSC/ISRO
>>>>> email: mmali110 at gmail.com
>>>>>            mmali at coaps.fsu.edu
>>>>> Mob: +91 9949045110
>>>>>
>>>>
>>>>
>>>> --
>>>> *Dr. MM Ali*
>>>> Formerly:
>>>> Scientist G & Group Director
>>>> NRSC/ISRO
>>>> email: mmali110 at gmail.com
>>>>            mmali at coaps.fsu.edu
>>>> Mob: +91 9949045110
>>>>
>>>
>>
>> --
>> *Dr. MM Ali*
>> Formerly:
>> Scientist G & Group Director
>> NRSC/ISRO
>> email: mmali110 at gmail.com
>>            mmali at coaps.fsu.edu
>> Mob: +91 9949045110
>>
>

-- 
*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/20190407/191cb566/attachment.html>


More information about the ncl-talk mailing list