[gradsusr] set shp -poly

Jennifer Adams jma at cola.iges.org
Thu Jan 5 12:12:32 EST 2012


On Jan 5, 2012, at 11:07 AM, Jeff Lake wrote:

> Jennifer...
> 
>     I gave it a try, had my reservations with all the lines …

> what I meant by the comment on the dbf was I have never seen
> the listing of 'min_value' and 'max_value' , that was a first for me..
A shaded contour (and its component polygons) represents an area where data values are > min_value and <= max_value, so both numbers are important pieces of metadata. 
--Jennifer

> 
> now to write up my scripting for wgrib2 to pull out a list of locations
> to plot on the map...
> 
> anybody interested ...
> 
> GRIB2 --> 
> GRaDS shapefile conversion --> 
> OGR2OGR postgresql GIS database -->
> custom php scripting for maps
> 
> all total it takes less then 45 seconds for my system to complete
> the above ..
> 
> -Jeff Lake
> MichiganWxSystem.com
> WeatherMichigan.net
> TheWeatherCenter.net
> GRLevelXStuff.com
> 
> On 1/4/2012 6:20 PM, Jennifer Adams wrote:
>> 
>> Jeff, 
>> 
>> On Jan 4, 2012, at 12:19 PM, Jeff Lake wrote:
>> 
>>> This is exactly the problem ...
>>> the dbf is also in a format I nor GDAL has ever seen before,
>> In GrADS, you can issue the 'q dbf' command and it will spew the contents of the dbf file. The utility 'dbfdump', which comes with the shapefile library, also has no trouble reading the dbf file. There is very little structure to the dbf file, it's just a list of attributes and the values that go with them for each element in the file. 
>> 
>>> could be this temp, but yet it could be this???
>> I'm sorry, but I don't understand this statement. 
>> 
>>> 
>>> this is the GRIB file I'm using
>>> http://weather.noaa.gov/pub/SL.us008001/ST.opnl/DF.gr2/DC.ndgd/GT.rtma/AR.conus/RT.01/ds.temp.bin
>>> 
>>> the RT.01 determines the cycle hour
>>> 
>>> GrADS version 2.0.1,
>>> CentOS 5.7 64bit
>>> 
>>> 
>>> and the script snippet
>>> 
>>> 'clear shp'
>>> 'set lat 20 55'
>>> 'set lon -150 -45'
>>> 'set gxout shp'
>>> 'set mproj latlon'
>>> 'set ccols 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22'
>>> 'set clevs -40 -35 -30 -25 -20 -15 -10 -5 0 5 10 15 20 25 30 35 40 45 50 
>>> 55 60 65 70 75 80 85 90 95 100 105 110 115 120 125 130 135'
>>> 'set shp -poly rtma_temp'
>>> 'd (TMP2m-273.16)*9/5+32'
>>> 'quit'
>> 
>> I grabbed the file, used g2ctl, and drew a grfill plot with GrADS, overlaying a shapefile with the state boundaries (instead of the default map plotted by GrADS). Here is the result:
>> <Mail Attachment.png>
>> Next I used 'gxout shp' and created a shapfile based on this data. Then I import the shapefile I created into Qgis and draw it using no outline and coloring in the polygons according to the classification field MIN_VALUE and then overlay the same shapefile (statesp020) and get this: 
>> 
>> <Mail Attachment.png>
>> 
>> There is no re-projecting going on, the plots are the same, other than the color scheme -- it's a pain to define colors in Qgis, so I used this blue/green palette. As far as I can tell, there is nothing wrong with the shapefile created by GrADS. 
>>> 
>>> 
>>> I would let GrADS do my mapping, but I'm some what of a stickler about 
>>> my maps looking the same
>>> I cannot for the life of me get GrADS to match my projection
>>> http://contours.michiganwxsystem.com/forecasts/gfs/gfsmos_d1_maxt.png
>>> I got GEMPAK to match (and they say that is harder), but not GrADS :(
>> 
>> As for the projection in your michiganwxsystem plot, it doesn't appear to be drawn with GrADS, but it looks like a polar stereographic projection. In GrADS, use 'set mproj nps' and then display your temperature plot and it will look like this: 
>> 
>> <Mail Attachment.png>
>> 
>> 
>> This looks like the projection in the image on your website. As for getting Qgis to draw in a polar stereographic projection … I have no idea how to do this. Perhaps this is another user in the forum who will know. 
>> --Jennifer
>> 
>>> 
>>> -Jeff Lake
>>> MichiganWxSystem.com
>>> WeatherMichigan.net
>>> TheWeatherCenter.net
>>> GRLevelXStuff.com
>>> 
>>> 
>>> On 1/3/2012 7:43 PM, Yaqiang Wang wrote:
>>>> It seems GrADS does not form real 'polygon' from contour lines by
>>>> topology analysis. This is the source of the problem.
>>>> 
>>>> On Wed, Jan 4, 2012 at 7:17 AM, Jennifer Adams<jma at cola.iges.org>  wrote:
>>>>> Jeff,
>>>>> The shapfile interface in GrADS creates a shapefile that contains polygons
>>>>> that fill out the areas outlined by the shaded contours. Because of the
>>>>> rules in the shapefile spec regarding polygon geometry, the area inside a
>>>>> shaded contour is split up into many pieces so that individual polygons do
>>>>> not overlap and do not contain holes (no donuts). That is why you are seeing
>>>>> all the vertical lines. If you color in the polygons and use the same color
>>>>> to draw the outline, you won't see the vertical lines and the plot will look
>>>>> more normal (like the shaded contour plot in GrADS).
>>>>> 
>>>>> Also, before you create the shapefile, you must be in the latlon projection
>>>>> (set mproj latlon). No other projection will work. It should be possible to
>>>>> use your GIS tool to re-project the data in the shapefile using the metadata
>>>>> in the file provided by GrADS. From the attachement you sent, it's difficult
>>>>> to tell what the problem is -- better to draw a plot of a variable such a
>>>>> land mask that would clearly show whether the boundaries in the data are
>>>>> lining up with the political boundaries (and color them in and use matching
>>>>> outline color). If there is an issue in the way Qgis is re-projecting the
>>>>> shapefile, then that may or may not be a GrADS problem.
>>>>> 
>>>>> The polygons 'connect to the outside' because they are filling in the
>>>>> lat/lon block defined by your dimension environment. You can't mask your
>>>>> shapefile according to political boundaries, but you can choose to not draw
>>>>> a certain contour level by using -1 instead of a color number in the 'set
>>>>> ccols' command.
>>>>> 
>>>>> I can't help you any further without more specific information about what
>>>>> version of GrADS you're using, what the descriptor file looks like for your
>>>>> data, the source of your data file (so I can grab a sample), what your
>>>>> commands were to generate the shapefile, and what you did inside Qgis to
>>>>> create the display in your attachment.
>>>>> --Jennifer
>>>>> 
>>>>> 
>>>>> 
>>>>> 
>>>>> On Jan 3, 2012, at 4:22 PM, Jeff Lake wrote:
>>>>> 
>>>>> I believe there is a minor, okay major, flaw in the conversion to shape file
>>>>> here is the shape file I get when converting the RTMA GRIB over (see
>>>>> attachment)
>>>>> the resulting polygons all 'connect' to the outside
>>>>> this is a cint set from -30 to 140 by 5 degree's
>>>>> this is a better result then another piece of software, but still not
>>>>> correct..
>>>>> 
>>>>> anybody got suggestions ??
>>>>> 
>>>>> --
>>>>> -Jeff Lake
>>>>> MichiganWxSystem.com
>>>>> WeatherMichigan.net
>>>>> TheWeatherCenter.net
>>>>> GRLevelXStuff.com
>>>>> 
>>>>> <rtma.jpg>_______________________________________________
>>>>> gradsusr mailing list
>>>>> gradsusr at gradsusr.org
>>>>> http://gradsusr.org/mailman/listinfo/gradsusr
>>>>> 
>>>>> 
>>>>> --
>>>>> Jennifer M. Adams
>>>>> IGES/COLA
>>>>> 4041 Powder Mill Road, Suite 302
>>>>> Calverton, MD 20705
>>>>> jma at cola.iges.org
>>>>> 
>>>>> 
>>>>> 
>>>>> 
>>>>> _______________________________________________
>>>>> 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
>> 
>> --
>> Jennifer M. Adams
>> IGES/COLA
>> 4041 Powder Mill Road, Suite 302
>> Calverton, MD 20705
>> jma at cola.iges.org
>> 
>> 
>> 
>> 
>> 
>> _______________________________________________
>> gradsusr mailing list
>> gradsusr at gradsusr.org
>> http://gradsusr.org/mailman/listinfo/gradsusr
> <rtma_current.png>_______________________________________________
> gradsusr mailing list
> gradsusr at gradsusr.org
> http://gradsusr.org/mailman/listinfo/gradsusr

--
Jennifer M. Adams
IGES/COLA
4041 Powder Mill Road, Suite 302
Calverton, MD 20705
jma at cola.iges.org



-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://gradsusr.org/pipermail/gradsusr/attachments/20120105/065dbdc2/attachment-0003.html 


More information about the gradsusr mailing list