[ncl-talk] Need help for extracting the polygon average value for a parameter from wrfout* file using a shapefile

Mary Haley haley at ucar.edu
Fri Mar 6 09:00:17 MST 2015


Dipak,

I do see your other message to me offline, but I will send this example in
case it helps.  Sorry it took so long.

This example uses the HGT variable on a WRF output file, because this is an
easy one to see if the values look correct.  I then used the USA_adm
shapefile to get all the counties in Pennsylvania (mostly so it would run
faster while I was testing it) and averaged the HGT value over each county.
The function that does the averaging also draws filled polygons on a map
plot of the averaged area, so you can compare the plots.

See the attached script, and the final PNG image which shows the original
HGT field as a filled contour plot, and then the HGT field over
Pennsylvania only, averaged for each county.

--Mary

On Wed, Mar 4, 2015 at 4:04 PM, Mary Haley <haley at ucar.edu> wrote:

> I will create an example for you soon, based on shapefiles_14.ncl and
> shapefiles_11.ncl
>
> --Mary
>
>
> On Tue, Mar 3, 2015 at 2:13 PM, Dipak Sahu <dipakmath at gmail.com> wrote:
>
>> Dear NCL developers and experts
>>     Now I have some issues with wrfout files from WRF model. I need to
>> extract the polygon average value of surface temperatures for each polygon
>> using a shapefile over southern California. I have the shapefiles with
>> .shp, .dbf, .sbx, .shx and .sbn.
>>
>> I just able to plot the variables for different polygon (i.e, for
>> different county) with the help of the sample script "shapefiles_11.ncl",
>> but still I am facing problem how to make the average over the county and
>> how to save the masked county data in .nc file or .csv file with latitude,
>> longitude and variable.
>>
>> I am waiting for any suggestions and help from the NCL experts how to
>> resolve this issue. If any sample scripts are there it will be more
>> appreciable.
>>
>> with thanks and regards
>> Dipak
>>
>>
>> _______________________________________________
>> ncl-talk mailing list
>> 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/20150306/98cb156c/attachment.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: shapefiles_14_mod.ncl
Type: application/octet-stream
Size: 2548 bytes
Desc: not available
Url : http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20150306/98cb156c/attachment.obj 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: wrf_shape.png
Type: image/png
Size: 188954 bytes
Desc: not available
Url : http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20150306/98cb156c/attachment.png 


More information about the ncl-talk mailing list