[ncl-talk] plotting country outline with shapefiles

Rick Brownrigg brownrig at ucar.edu
Tue Jan 5 12:11:01 MST 2021


Well this is truly bizarre. There's nothing I can think of that would or
should account for the lat/lon coordinate swapping between the two machines
(unless the shapefile_utils.ncl files are different across the two
machines). Things work as expected for me. Unfortunately, without access to
something like machine #2 that exhibits the behavior, I personally have no
way of drilling down further to find out what the problem is.

Not that this helps solve the problem, but I'm curious if the x/y
coordinates are really juxtaposed; on machine #2:

     f=addfile("file_gor_2011.shp","r")
     print(f->x + " " + f->y)

Do those values look like they are swapped?

I wish I had a better answer for you :-/

Rick


On Tue, Jan 5, 2021 at 8:37 AM S Br <sbr.climate at gmail.com> wrote:

> Hi Rick,
> The below are the details.
>
> uname -a
> Computer#1
> Linux sbclim 4.15.0-128-generic #131-Ubuntu SMP Wed Dec 9 06:57:35 UTC
> 2020 x86_64 x86_64 x86_64 GNU/Linux
> Computer#2
> Linux sbclim 3.10.0-1127.19.1.el7.x86_64 #1 SMP Tue Aug 25 17:23:54 UTC
> 2020 x86_64 x86_64 x86_64 GNU/Linux
>
> ls -l file_gor_2011.shp
> Computer#1
> -rw-r--r-- 1 climdir env 413276 Dec  8 16:11 file_gor_2011.shp
> Computer#2
> -rw-r--r-- 1 climdir users 413276 Jan  5 10:54 file_gor_2011.shp
>
> Please find attached here the shape files.
>
> Thanks
> SB
>
>
>
> On Tue, Jan 5, 2021 at 2:37 PM Rick Brownrigg <brownrig at ucar.edu> wrote:
>
>> Hi,
>>
>> That result is very strange indeed. What are computers 1 and 2, i.e.,
>> what is the output of:
>>
>>    uname -a
>>
>> And just to be certain, what is the output of this on each computer:
>>
>>   cd ...to-directory-where-file_gor_2011.shp-resides....
>>   ls -l file_gor_2011.shp
>>
>> Finally, can you send me file_gor_2011.shp (recall that means the .sph,
>> .shx, .dbf files)?
>>
>> Rick
>>
>> On Tue, Jan 5, 2021 at 5:53 AM S Br via ncl-talk <
>> ncl-talk at mailman.ucar.edu> wrote:
>>
>>> Hi Dave,
>>> Thanks for your reply.
>>> I have now compared the diagnostic results between the two computers and
>>> the below are the results.
>>> *Computer#1:*
>>> (0)
>>> ======================================================================
>>> (0) Filename: "file_gor_2011.shp"
>>> (0)   Geometry type: polygon
>>> (0)   # of features: 1
>>> (0)   Min/max lat:     51.29/  51.69
>>> (0)   Min/max lon:     -0.51/   0.33
>>> (0)   Variable names and their types:
>>> (0)       geometry : integer
>>> (0)       segments : integer
>>> (0)       x : double
>>> (0)       y : double
>>> (0)       label : string
>>> (0)       name : string
>>> (0)       code : string
>>> (0)
>>> ======================================================================
>>> *Computer#2:*
>>> (0)
>>> ======================================================================
>>> (0) Filename: "file_gor_2011.shp"
>>> (0)   Geometry type: polygon
>>> (0)   # of features: 1
>>> (0)   Min/max lat:     -0.51/   0.33
>>> (0)   Min/max lon:     51.29/  51.69
>>> (0)   Variable names and their types:
>>> (0)       geometry : integer
>>> (0)       segments : integer
>>> (0)       x : double
>>> (0)       y : double
>>> (0)       label : string
>>> (0)       name : string
>>> (0)       code : string
>>> (0)
>>> ======================================================================
>>>
>>> I could see in one computer (computer#2 above) that the latitude values
>>> are replacing the longitude values and vice versa, and that may be the
>>> reason the country outlines are not displaying here.
>>>
>>> Could you please suggest how to solve this issue? I am using the same
>>> data, scripts and only difference is the computer.
>>>
>>> Thank you.
>>> SB
>>>
>>>
>>> On Wed, Dec 9, 2020 at 5:30 PM Dave Allured - NOAA Affiliate <
>>> dave.allured at noaa.gov> wrote:
>>>
>>>> It would be better to apply debugging techniques to narrow down the
>>>> problem, rather than to speculate as to the cause.  Use *addfile* to
>>>> see if NCL can read the shapefile.  Use diagnostic print statements to
>>>> examine the shapefile structure in memory.  Use *gsn_add_polygon* to
>>>> see if NCL can draw a simple outline.
>>>>
>>>> To understand the structure, refer to the shapefile documentation at
>>>> the top of the NCL shapefiles example page.  That mentions a special
>>>> procedure *print_shapefile_info* which will print additional useful
>>>> details.  Compare diagnostic results between your two computers.  Good luck.
>>>>
>>>>
>>>> On Wed, Dec 9, 2020 at 1:16 AM S Br via ncl-talk <
>>>> ncl-talk at mailman.ucar.edu> wrote:
>>>>
>>>>> Hi All,
>>>>> I am trying to plot a figure using the shapefile. Everything is
>>>>> working fine with the NCL script but it doesn't draw the country outline
>>>>> given as a shapefiles. However, the same script works fine in another
>>>>> computer and draws the required country outline using the shapefile.
>>>>> What could be the possible reason that the NCL script works fine but
>>>>> fails to draw the country outline using shapefiles without showing any
>>>>> error?
>>>>>
>>>>> Both the computers are installed with the NCL 6.6.2.
>>>>>
>>>>> Thank you.
>>>>> SB
>>>>>
>>>> _______________________________________________
>>> ncl-talk mailing list
>>> ncl-talk at mailman.ucar.edu
>>> List instructions, subscriber options, unsubscribe:
>>> https://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>
>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.ucar.edu/pipermail/ncl-talk/attachments/20210105/57fa2eb0/attachment.html>


More information about the ncl-talk mailing list