[ncl-talk] Overlay point shapefile on a plot

Mary Haley haley at ucar.edu
Thu Jul 6 09:39:07 MDT 2017


Hi Lyndz,

I've filed a ticket on this, NCL-2628. I don't know anything about how
GrADS writes shapefiles, but it does seem like you are writing the file the
way the GrADS documentation suggests.

Thanks for providing the files.

--Mary


On Wed, Jul 5, 2017 at 7:34 PM, Lyndon Mark Olaguera <
olagueralyndonmark429 at gmail.com> wrote:

> Dear Mary,
>
> Thank you for this. I actually created the shapefile in GRADS (
> http://cola.gmu.edu/grads/gadoc/shapefiles.html). Like this:
>
> ymin=1979
> ymax=1995
> 'sdfopen regpval_90%_hgt_'ymin'-'ymax'.nc'
> *'set gxout shp'*
> *'set shp -pt -fmt 8 4 sig_regpval_'ymin'-'ymax''*
> *'set shpattr AUTHOR string LYNDZ'*
> *'set shpattr TYPE string grid points'*
> *'set shpattr DESC string sig_regpval_'ymin'-'ymax''*
> *'d regpval'*
>
> For some unknown reason, NCL cannot recognize the geometry type. I checked
> the metadata in QGIS and the geometry type is "point" (see attached image).
>
>
> Sincerely,
>
> *Lyndz*
>
>
> On Thu, Jul 6, 2017 at 1:41 AM, Mary Haley <haley at ucar.edu> wrote:
>
>> Hi Lyndon,
>>
>> [Thanks Karin for helping out with this.]
>>
>> This is the first time I've seen a shapefile that didn't have a
>> "geometry_type" of "point", "polyline" or "polygon".  As Karin pointed out,
>> the shapefile should still plot just fine, but I will modifiy the
>> gsn_add_shapefile_xxxx routines so they are not so restrictive. Instead of
>> quitting with an error, I'll have them print a warning.
>>
>> --Mary
>>
>>
>> On Mon, Jul 3, 2017 at 8:29 AM, Lyndon Mark Olaguera <
>> olagueralyndonmark429 at gmail.com> wrote:
>>
>>> Hi Karin,
>>>
>>> I got it very clearly..Thank you so much.
>>>
>>> Lyndon
>>> On 3 Jul 2017 22:40, "Karin Meier-Fleischer" <meier-fleischer at dkrz.de>
>>> wrote:
>>>
>>>> Hi Lyndon,
>>>>
>>>> the projection is not the problem I just used the
>>>> cylindrical-equidistant projection to see the global map.
>>>>
>>>> The function gsn_add_shapefile_polymarkers reads the shapefile and scan
>>>> the global file attribute geometry_type. If it doesn't exist it directly
>>>> returns to the main script printing the error message.
>>>> There are two ways to go on, you can copy and edit the
>>>> gsn_add_shapefile_polymarkers function or you can draw the polymarkers as I
>>>> did in the modified script using the gsn_add_polymarker function.
>>>>
>>>> Bye, Karin
>>>>
>>>> Am 03.07.17 um 13:24 schrieb Lyndon Mark Olaguera:
>>>>
>>>> Dear Karin,
>>>>
>>>>
>>>> Thank you for the help. Actually, I was able to plot this successfully
>>>> by editing the shapefile attribute manually in QGIS. I need to plot it in
>>>> orthographic projection (Similar to the attached).
>>>>
>>>> Is it possible to specify the "geometry type" within the code (or edit
>>>> the shapefile attribute?) after reading the shapefile?
>>>>
>>>>
>>>> Many thanks,
>>>>
>>>> Lyndz
>>>>
>>>>
>>>>
>>>> On Mon, Jul 3, 2017 at 8:09 PM, Karin Meier-Fleischer <
>>>> meier-fleischer at dkrz.de> wrote:
>>>>
>>>>> Hi Lyndon,
>>>>>
>>>>> the problem is that your shapefile data does not contain point data
>>>>> which is needed by gsn_add_shapefile_polymarkers function
>>>>>
>>>>> http://ncl.ucar.edu/Document/Graphics/Interfaces/gsn_add_sha
>>>>> pefile_polymarkers.shtml
>>>>>
>>>>> To see what is in your shapefile you can draw the shapefile data using
>>>>> the x- and y-values. I've attached your modified script and the PNG plot.
>>>>>
>>>>> Hope this helps,
>>>>> Karin
>>>>>
>>>>>
>>>>> Am 03.07.17 um 04:37 schrieb Lyndon Mark Olaguera:
>>>>>
>>>>> Dear NCL experts,
>>>>>
>>>>> I am trying to add point shapefile to a plot using the
>>>>> gsn_add_shapefile_polymarkers function in NCL.
>>>>>
>>>>> To view the contents of the shapefile I used the shape_utils.ncl from
>>>>> the following link:
>>>>>
>>>>>
>>>>> *https://www.ncl.ucar.edu/Applications/shapefiles.shtml
>>>>> <https://www.ncl.ucar.edu/Applications/shapefiles.shtml> *
>>>>>
>>>>> I tried to plot the shapefile in GIS and it works fine but I still got
>>>>> an error that the geometry attribute should be a point when I plot it in
>>>>> NCL. I am not sure why in the filedump below, the geometry type is
>>>>> "unknown".
>>>>>
>>>>>
>>>>> I attached my script and the files that I am plotting.
>>>>>
>>>>>
>>>>> Variable: a
>>>>> Type: file
>>>>> File path: may_hgt-hgt_1996-2012_850hPa.nc
>>>>> Number of global attributes: 0
>>>>> Number of dimensions: 2
>>>>> Number of variables: 6
>>>>> (0) ============================================================
>>>>> ==========
>>>>> (0) Filename: "sig_regpval_1996-2012.shp"
>>>>> (0)   Geometry type: unknown
>>>>> (0)   # of features: 2906
>>>>> (0)   Min/max lat:    -80.00/  82.50
>>>>> (0)   Min/max lon:      0.00/ 360.00
>>>>> (0)   Variable names and their types:
>>>>> (0)       geometry : integer
>>>>> (0)       segments : integer
>>>>> (0)       x : double
>>>>> (0)       y : double
>>>>> (0)       z : double
>>>>> (0)       CREATED_BY : string
>>>>> (0)       AUTHOR : string
>>>>> (0)       TYPE : string
>>>>> (0)       DESC : string
>>>>> (0)       LONGITUDE : double
>>>>> (0)       LATITUDE : double
>>>>> (0)       GRID_VALUE : double
>>>>> (0) ============================================================
>>>>> ==========
>>>>> (0) Error: gsn_add_shapefile_polymarkers: geometry_type attribute
>>>>> must be 'point'
>>>>> (0)       No shapefile information will be added.
>>>>>
>>>>>
>>>>> I'll appreciate any suggestion on how I can plot this correctly.
>>>>>
>>>>> Thank you in advance.
>>>>>
>>>>> Lyndz
>>>>>
>>>>>
>>>>>
>>>>> _______________________________________________
>>>>> ncl-talk mailing listncl-talk at ucar.edu
>>>>> List instructions, subscriber options, unsubscribe:http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>>>>
>>>>> --
>>>>> Dipl. Geophys. Karin Meier-Fleischer
>>>>> Visualization, NCL, CDO
>>>>> Application Support
>>>>>
>>>>> Deutsches Klimarechenzentrum GmbH (DKRZ)
>>>>> Bundesstrasse 45a - D20146 Hamburg - Germany
>>>>>
>>>>> Phone:    +49 (0)40 460094 126 <+49%2040%20460094126>
>>>>> Fax:      +49 (0)40 460094 270 <+49%2040%20460094270>
>>>>> E-Mail:   meier-fleischer at dkrz.de
>>>>> URL:      www.dkrz.de
>>>>>
>>>>> Geschäftsführer: Prof. Dr. Thomas Ludwig
>>>>> Sitz der Gesellschaft: Hamburg
>>>>> Amtsgericht Hamburg HRB 39784
>>>>>
>>>>> _______________________________________________ ncl-talk mailing list
>>>>> ncl-talk at ucar.edu List instructions, subscriber options, unsubscribe:
>>>>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>>>
>>>> --
>>>> Dipl. Geophys. Karin Meier-Fleischer
>>>> Visualization, NCL, CDO
>>>> Application Support
>>>>
>>>> Deutsches Klimarechenzentrum GmbH (DKRZ)
>>>> Bundesstrasse 45a - D20146 Hamburg - Germany
>>>>
>>>> Phone:    +49 (0)40 460094 126 <+49%2040%20460094126>
>>>> Fax:      +49 (0)40 460094 270 <+49%2040%20460094270>
>>>> E-Mail:   meier-fleischer at dkrz.de
>>>> URL:      www.dkrz.de
>>>>
>>>> Geschäftsführer: Prof. Dr. Thomas Ludwig
>>>> Sitz der Gesellschaft: Hamburg
>>>> Amtsgericht Hamburg HRB 39784
>>>>
>>>>
>>> _______________________________________________
>>> 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/20170706/acb1d1cc/attachment.html 


More information about the ncl-talk mailing list