Re: County average using shape files

From: Mary Haley <haley_at_nyahnyahspammersnyahnyah>
Date: Tue Jul 01 2014 - 23:05:45 MDT

Hi Carl,

One guess at the problem is that the min/max longitude you've specified is
in the range 0 to 360, and the longitudes in the shapefile are probably
-180 to 180.

Try subtracting 360 from your minlon/maxlon values and see if this helps.

I'm not sure how many points you need to mask, but checking against every
county outline in the United States could get quite expensive, since some
counties have several segments that you need to check against. This is
especially true for coastal areas.

I've created a modified version of shapefiles_13.ncl that should check
against every county in the U.S. This example was taking a really long
time, so I decided to limit the area to just New Mexico and Colorado. You
will need to remove the two locations where I specify these two states.
Search for the word "kludge" and you will see the code you'll need to
modify.

See attached script and image.

--Mary


On Tue, Jul 1, 2014 at 11:21 AM, Cary Lynch <lynchc6@uw.edu> wrote:

> Hello,
> I am having trouble calculating the US county area averages using gridded
> CONUS data and US county shape file data. The county polyline overlay
> works, but I cannot get the county area average function to work with my
> data.
> Following the example script
> www.ncl.ucar.edu/Applications/Scripts/shapefiles_13.ncl
> I am getting the following error:
>
> fatal: Subscript out of range, error in subscript #0
> fatal: An error occurred reading skip_check
>
> ;The CONUS data is land only for the coterminous US:
>
> hf1 = addfile("conus.nc","r")
> data = hf1->tmaxhist(:,:) ; ((/nlat,nlon/),float)
> lat = hf1->lat
> lon = hf1->lon
>
> ; The attributes of data and lat/lon are as follows:
> ; nlat = 222
> ; nlon = 462
> ; minlat/maxlat = 25.1875/52.8125
> ; minlon/maxlon = 235.312/292.938
> ; lat@units = "degrees_north"
> ; lon@units = "degrees_east"
>
>
> Any help would be much appreciated. Thank you.
> --
> Cary Lynch
>
>
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
>

Received on Wed Jul 02 05:05:45 2014

This archive was generated by hypermail 2.1.8 : Wed Jul 23 2014 - 15:33:46 MDT