[gradsusr] still having trouble with shapefiles

Jeff Duda jeffduda319 at gmail.com
Sat Mar 26 23:47:19 EDT 2022


Hey Jason,
I may not have correctly interpreted your initial issue, and therefore gave
you advice that wasn't going to solve your particular problem.

Let's forget about writing to a new shapefile.

Instead, what if you looped through each of the entries in the dbf entries,
parsed out the data to obtain the specific type of product (SVR, SMW, RFW),
and then plotted each individual shapefile with you assigned colors/line
attributes? The pseudo code would look something like

'q dbf [shapefile]' --> write results to an external ASCII file
*read from external ASCII file using GrADS scripting language

stat = 0
while (stat = 0)
 read([extrnal ASCII file]) [note: "read" is an actual GrADS scripting
language command to read from a text file...you do not need to open the
text file first]
 stat = sublin(result,1)
 rec = sublin(result,2)
 if (stat = 0)
  * parse "rec" value to obtain the type of product in the DBF line
  type = subwrd(rec,[whatever])
  if (type = "RFW')
   * set shapefile plotting options for this product type
  endif
  if (type = "SVR)
   * set shapefile plotting options for this product type
  endif
  if (type = "SMW')
   * set shapefile plotting options for this product type
  endif
  'd shp [rec number], which should be the first bit at the beginning of
each line of the DBF
 else [if there is an error, stat will be some other value, and you can
tell what it is based on the documentation for this function call]
  * skip this entry, exit loop, or whatever else
endwhile

Jeff Duda

On Fri, Mar 25, 2022 at 10:49 PM Jason M. Warren <jason at solargrafix.com>
wrote:

> I still can not figure this out.  Here is what I have come up with:
>
> 'set shp -line C:\OpenGrADS-2.2\data\haz\current_all'
> 'set gxout shp'
> 'set shp -ln -fmt 8 4 linem'
> 'set shpattr AUTHOR string SPC'
> 'set shpattr TYPE string grid lines'
> 'set shpattr DESC string red flag warning'
> 'd var209113_500m'
>
> I can not figure out how to define the shapefile element, which in this
> instance would be RFW.  I also can not figure out how to output to a new
> shapefile.  Any assistance would be greatly appreciated.
>
>
> Thank you,
>
> Jason Warren
>
>
>
> On 3/7/2022 18:35, gradsusr-request at gradsusr.org wrote:
> > Send gradsusr mailing list submissions to
> >       gradsusr at gradsusr.org
> >
> > To subscribe or unsubscribe via the World Wide Web, visit
> >       http://gradsusr.org/mailman/listinfo/gradsusr
> > or, via email, send a message with subject or body 'help' to
> >       gradsusr-request at gradsusr.org
> >
> > You can reach the person managing the list at
> >       gradsusr-owner at gradsusr.org
> >
> > When replying, please edit your Subject line so it is more specific
> > than "Re: Contents of gradsusr digest..."
> >
> >
> > Today's Topics:
> >
> >     1. Re: Plotting shapefile elements (Jeff Duda)
> >     2. Re: [EXTERNAL] Re:  Plotting shapefile elements
> >        (Adams, Jennifer M. (GSFC-610.2)[ADNET SYSTEMS INC])
> >
> >
> > ----------------------------------------------------------------------
> >
> > Message: 1
> > Date: Mon, 7 Mar 2022 10:23:28 -0700
> > From: Jeff Duda <jeffduda319 at gmail.com>
> > To: GrADS Users Forum <gradsusr at gradsusr.org>
> > Subject: Re: [gradsusr] Plotting shapefile elements
> > Message-ID:
> >       <CAAig09Duramt92AdAEXfKiBPtHHVyqO97ium=
> J9HULcd_K3aSw at mail.gmail.com>
> > Content-Type: text/plain; charset="utf-8"
> >
> > Consult the GrADS user's page on shapefiles first:
> > http://cola.gmu.edu/grads/gadoc/shapefiles.html
> >
> > I recommend writing each set of product types to a separate shapefile
> using
> > 'gxout shp' and 'shpattr' to control which elements are draw to which
> file.
> > Then plot all elements of each shapefile separately using traditional
> means.
> >
> > Jeff Duda
> >
> > On Mon, Mar 7, 2022 at 4:16 AM Jason M. Warren <jason at solargrafix.com>
> > wrote:
> >
> >> Hello,
> >>
> >> I am trying to plot a shapefile which contains multiple elements.  I
> >> queried the shp and dbf files as follows:
> >>
> >>
> >> ga-> q shp current_warnings
> >> Shapefile Type=Polygon #Shapes=4 XBounds=-88.9:-86.86
> YBounds=29.38:37.16
> >> 0:  Polygon  parts=1  vertices=5  XBounds=-88.05:-86.86
> >> YBounds=29.38:30.01  ZBounds=0:0  MBounds=0:0
> >> 1:  Polygon  parts=1  vertices=19  XBounds=-88.49:-87.05
> >> YBounds=36.5:37.16  ZBounds=0:0  MBounds=0:0
> >> 2:  Polygon  parts=1  vertices=8  XBounds=-88.9:-88.36
> >> YBounds=31.43:31.63  ZBounds=0:0  MBounds=0:0
> >> 3:  Polygon  parts=1  vertices=11  XBounds=-88.35:-88.01
> >> YBounds=32.05:32.25  ZBounds=0:0  MBounds=0:0
> >>
> >>
> >> ga-> q dbf current_warnings
> >>
> RECORD#,PHENOM,SIG,WARNID,WFO,EVENT,ISSUANCE,EXPIRATION,URL,MSG_TYPE,PROD_TYPE
> >>
> >>
> >> 0,MA,W,O.NEW.KMOB.MA.W.0008.0109022
> >>           2070225.670784,KMOB,0008,2022-01-09 19:02:25,2022-01-09
> >> 21:00:00,
> >>
> http://forecast.weather.gov/product.php?site=MOB&issuedby=MOB&product=SMW,SMW,Marine
> >> Warning
> >> 1,FF,W,O.CON.KPAH.FF.W.0005.0109022
> >>           2055627.670773,KPAH,0005,2022-01-09 17:56:27,2022-01-09
> >> 21:15:00,
> >>
> http://forecast.weather.gov/product.php?site=PAH&issuedby=PAH&product=FFS,FFS,Flash
> >> Flood Warning
> >> 2,SV,W,O.NEW.KMOB.SV.W.0003.0109022
> >>           2072922.670791,KMOB,0003,2022-01-09 19:29:22,2022-01-09
> >> 20:15:00,
> >>
> http://forecast.weather.gov/product.php?site=MOB&issuedby=MOB&product=SVR,SVR,Severe
> >> Thunderstorm Warning
> >> 3,SV,W,O.CON.KMOB.SV.W.0001.0109022
> >>           2072321.670789,KMOB,0001,2022-01-09 19:23:21,2022-01-09
> >> 19:45:00,
> >>
> http://forecast.weather.gov/product.php?site=MOB&issuedby=MOB&product=SVS,SVS,Severe
> >> Thunderstorm Warning
> >>
> >>
> >> However, I can not figure out how to plot this with different colors for
> >> each element (SVR, SMW, etc...).  I have tried the following code which
> >> plots everything in the shapefile...
> >>
> >>
> >> 'set rgb 1  255 0 0 255'
> >> 'set shpopts -1'
> >> 'set line 1 1 1'
> >> 'draw shp current_warnings'
> >>
> >>
> >> But I need to know how to draw each kind of element separately (SVR,
> >> SMW, etc...).
> >>
> >> Thanks,
> >>
> >> Jason Warren
> >>
> >> _______________________________________________
> >> gradsusr mailing list
> >> gradsusr at gradsusr.org
> >> http://gradsusr.org/mailman/listinfo/gradsusr
> >>
> >
> _______________________________________________
> gradsusr mailing list
> gradsusr at gradsusr.org
> http://gradsusr.org/mailman/listinfo/gradsusr
>


-- 
Jeff Duda, Research Scientist
University of Colorado Boulder
Cooperative Institute for Research in Environmental Sciences
NOAA/OAR/ESRL/Global Systems Laboratory
Boulder, CO
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://gradsusr.org/pipermail/gradsusr/attachments/20220326/a801c103/attachment.html>


More information about the gradsusr mailing list