<div dir="ltr"><div dir="ltr"><div>SB and Rick,</div><div><br></div><div>I am responding to this old shapefile problem, originally reported on December 9.  The same problem was found with recent NCL builds on other systems.  You can consider this a bug within NCL, until it is solved.  The issue is being tracked on NCL Github here:</div><div><br></div><div>    <a href="https://github.com/NCAR/ncl/issues/151">https://github.com/NCAR/ncl/issues/151</a><br></div><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Jan 5, 2021 at 4:16 PM Dave Allured - NOAA Affiliate <<a href="mailto:dave.allured@noaa.gov">dave.allured@noaa.gov</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div>SB,</div><div><br></div><div>Thank you for running some diagnostics.  The direct approach with addfiles is important.  The following things are now eliminated from this problem:</div><div><br></div><div>* Your NCL scripts</div><div>* Any part of NCL shapefile_utils.ncl</div><div><br></div><div>These remain as possible candidates:</div><div><br></div><div>* Your actual shapefiles</div><div>* Shapefile driver inside NCL</div><div>* Shapefile support libraries</div><div><br></div><div>I see that there are two different file dates on your shapefile.  Please ensure they are actually the same file.  Check this with "md5sum file_gor_2011.shp" on the Linux command line.  They should result in identical checksum strings.</div><div><br></div><div>If you know how NCL was installed on each machine, then you should be able to check the version numbers of the shapefile support libraries.  Look at GDAL (libgdal) in particular.  There may be other libraries involved.  I do not know the details of the library stack for shapefiles.  If you find different library versions, I suggest updating the older one to a more recent version.  It may be necessary to rebuild or re-install NCL to accomplish this.</div><div><br></div><div>If you have "ogrinfo" installed for the Linux command line, use this to list the shapefile layer names like this:</div><br>    ogrinfo file_gor_2011.shp<br><br></div><div>Then insert one of those layer names into this command to get a geometry summary for that layer.  The bounding coordinates are reported on a line labeled "Extents".  See whether the geometry is consistent between machines.</div><div><br></div><div dir="ltr">    ogrinfo -geom=NO -fields=NO file_gor_2011.shp <i>layer-name</i></div><div dir="ltr"><br><div>This command is a part of GDAL, not NCL.  If you have an out of date library problem, it might show up in the geometry results from ogrinfo.  I can not guarantee this, but it is easy to try if you have ogrinfo installed.</div><div><br></div><div><br></div><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Jan 5, 2021 at 1:40 PM S Br <<a href="mailto:sbr.climate@gmail.com" target="_blank">sbr.climate@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div dir="ltr">Hi Rick,<div>Thanks for trying.</div><div>I am using the same shapefile_utils.ncl across the two machines.</div><div>As you suggest, I have tried the command in both machines and it looks like x/y coordinates are swapped in maschine #2 as shown below.</div><div><br></div><div><b>machine #1</b></div><div>(0)     -0.1916935366010736 51.34212550232069<br>(1)     -0.1918504471635003 51.34216369759741<br>(2)     -0.1919426195340767 51.3421861363549<br>.</div><div>.</div><div>.</div><div>(25817) -0.1912990774713476 51.34202950288345<br>(25818) -0.1916318559031973 51.34211049447309<br>(25819) -0.1916935366010736 51.34212550232069<br></div><div><br></div><div><b>machine #2</b></div><div>(0)     51.34212549581116 -0.1916934955276336<br>(1)     51.34216369108803 -0.1918504060899556<br>(2)     51.34218612984562 -0.1919425784604706<br></div><div>.</div><div>.</div><div>.</div><div>(25817) 51.34202949637353 -0.1912990363981704<br>(25818) 51.34211048796352 -0.1916318148297985<br>(25819) 51.34212549581116 -0.1916934955276336<br></div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Jan 5, 2021 at 7:11 PM Rick Brownrigg <<a href="mailto:brownrig@ucar.edu" target="_blank">brownrig@ucar.edu</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>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. <br></div><div><br></div><div>Not that this helps solve the problem, but I'm curious if the x/y coordinates are really juxtaposed; on machine #2:</div><div><br></div><div>     f=addfile("file_gor_2011.shp","r")</div><div>     print(f->x + " " + f->y)</div><div><br></div><div>Do those values look like they are swapped?</div><div><br></div><div>I wish I had a better answer for you :-/</div><div><br></div><div>Rick</div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Jan 5, 2021 at 8:37 AM S Br <<a href="mailto:sbr.climate@gmail.com" target="_blank">sbr.climate@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>Hi Rick,</div><div>The below are the details.</div><div><br></div><div>uname -a</div><div>Computer#1</div><div>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<br></div><div>Computer#2<br></div><div>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<br></div><div><br></div><div>ls -l file_gor_2011.shp<br></div><div>Computer#1<br></div><div>-rw-r--r-- 1 climdir env 413276 Dec  8 16:11 file_gor_2011.shp<br></div><div>Computer#2<br></div><div>-rw-r--r-- 1 climdir users 413276 Jan  5 10:54 file_gor_2011.shp<br></div><div><br></div><div>Please find attached here the shape files.</div><div><br></div><div>Thanks</div><div>SB</div><div><br></div><div><br></div><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Jan 5, 2021 at 2:37 PM Rick Brownrigg <<a href="mailto:brownrig@ucar.edu" target="_blank">brownrig@ucar.edu</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>Hi,</div><div><br></div><div>That result is very strange indeed. What are computers 1 and 2, i.e., what is the output of:</div><div><br></div><div>   uname -a</div><div><br></div><div>And just to be certain, what is the output of this on each computer:</div><div><br></div><div>  cd ...to-directory-where-file_gor_2011.shp-resides....</div><div>  ls -l file_gor_2011.shp</div><div><br></div><div>Finally, can you send me file_gor_2011.shp (recall that means the .sph, .shx, .dbf files)?</div><div><br></div><div>Rick<br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Jan 5, 2021 at 5:53 AM S Br via ncl-talk <<a href="mailto:ncl-talk@mailman.ucar.edu" target="_blank">ncl-talk@mailman.ucar.edu</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>Hi Dave,</div><div>Thanks for your reply. </div><div>I have now compared the diagnostic results between the two computers and the below are the results.</div><div><b>Computer#1:</b></div><div>(0)        ======================================================================<br>(0)     Filename: "file_gor_2011.shp"<br>(0)       Geometry type: polygon<br>(0)    # of features: 1<br>(0)          Min/max lat:     51.29/  51.69<br>(0)         Min/max lon:     -0.51/   0.33<br>(0)         Variable names and their types:<br>(0)               geometry : integer<br>(0)              segments : integer<br>(0)              x : double<br>(0)              y : double<br>(0)              label : string<br>(0)          name : string<br>(0)           code : string<br>(0)    ======================================================================<br></div><div><b>Computer#2:</b><br></div><div>(0)       ======================================================================<br>(0)     Filename: "file_gor_2011.shp"<br>(0)       Geometry type: polygon<br>(0)    # of features: 1<br>(0)          Min/max lat:     -0.51/   0.33<br>(0)         Min/max lon:     51.29/  51.69<br>(0)         Variable names and their types:<br>(0)               geometry : integer<br>(0)              segments : integer<br>(0)              x : double<br>(0)              y : double<br>(0)              label : string<br>(0)          name : string<br>(0)           code : string<br>(0)    ======================================================================<br></div><div><br></div><div>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.</div><div><br></div><div>Could you please suggest how to solve this issue? I am using the same data, scripts and only difference is the computer.</div><div><br></div><div>Thank you.</div><div>SB</div><div><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Dec 9, 2020 at 5:30 PM Dave Allured - NOAA Affiliate <<a href="mailto:dave.allured@noaa.gov" target="_blank">dave.allured@noaa.gov</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div dir="ltr"><div>It would be better to apply debugging techniques to narrow down the problem, rather than to speculate as to the cause.  Use <b>addfile</b> to see if NCL can read the shapefile.  Use diagnostic print statements to examine the shapefile structure in memory.  Use <b>gsn_add_polygon</b> to see if NCL can draw a simple outline.</div><div><br></div><div>To understand the structure, refer to the shapefile documentation at the top of the NCL shapefiles example page.  That mentions a special procedure <b>print_shapefile_info</b> which will print additional useful details.  Compare diagnostic results between your two computers.  Good luck.</div><div><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Dec 9, 2020 at 1:16 AM S Br via ncl-talk <<a href="mailto:ncl-talk@mailman.ucar.edu" target="_blank">ncl-talk@mailman.ucar.edu</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div dir="ltr">Hi All,<div>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.<br><div>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?</div><div><br></div><div>Both the computers are installed with the NCL 6.6.2.<br></div><div><br></div><div>Thank you.</div><div>SB</div></div></div></blockquote></div></div></div></blockquote></div></div></blockquote></div>
</blockquote></div></div>
</blockquote></div>
</blockquote></div>
</blockquote></div></div></div></div></div></div>
</blockquote></div></div></div>