[ncl-talk] Using Shapefiles to create subset from global forecast datasets

Rick Brownrigg brownrig at ucar.edu
Wed May 24 11:35:29 MDT 2017


Hi Toni,

Sorry for the delay in response. There are several examples of using
shapefiles to mask out data, if that's what are wanting to do. In
particular, look at examples 4, 5, and 21 at:

http://ncl.ucar.edu/Applications/shapefiles.shtml

II think there's a utility script they make use that you'll need to
download.  Hopefully this gets you at least started -- please post back the
list if you have other questions.

Rick

On Mon, May 22, 2017 at 10:10 PM, Klemm, Toni <toni at ou.edu> wrote:

> Good evening,
>
> I am analyzing seasonal climate forecasts skill for the U.S. Great Plains,
> specifically Texas, Oklahoma, Kansas, and Colorado. So far I’ve been using
> lat/lon to define my study region. However, this rectangular box includes
> parts of Mexico and the Gulf of Mexico that are outside my study region and
> which have extreme outliers that distort my results.
>
> To get more accurate results, I’d like to use a shapefile of my 4 states (
> TX_OK_KS_CO.shp, created in QGIS 2.18 from a U.S. states shapefile) to
> define my study region. However, I’m not sure how to interpret and use the
> results I’m getting. I used   “ncl_convert2nc TX_OK_KS_CO.shp -nc2c“  to
> create   “TX_OK_KS_CO.nc“ .
>
> “printVarSummary(TX_OK_KS_CO.nc)” and ”PrintMinMax“ of the x-coordinate
> (longitude) as well as y-coordinate (latitude) look like this:
>
> Variable: shp
> Type: file
> File path: /home/States_shapefile_data/GADM/TX_OK_KS_CO.nc
> Number of global attributes: 11
> Number of dimensions: 5
> Number of variables: 4
> (0) min=0   max=0
>
> ncdump -h TX_OK_KS_CO.nc returns this:
>
> netcdf TX_OK_KS_CO {
> dimensions:
> geometry = 2 ;
> segments = 2 ;
> num_features = 4 ;
> num_segments = 262 ;
> num_points = 102749 ;
> variables:
> int geometry(num_features, geometry) ;
> int segments(num_segments, segments) ;
> double x(num_points) ;
> double y(num_points) ;
>
> // global attributes:
> :segs_numPnts = 1 ;
> :segs_xyzIndex = 0 ;
> :geom_numSegs = 1 ;
> :geom_segIndex = 0 ;
> :geometry_type = "polygon" ;
> :layer_name = "TX_OK_KS_CO" ;
> :creation_date = "Mon May 22 17:20:46 EDT 2017" ;
> :NCL_Version = "6.4.0" ;
> :system = "Linux ou.edu x86_64 #1 SMP Fri Mar 3 00:04:05 UTC 2017 x86_64
> x86_64 x86_64 GNU/Linux" ;
> :Conventions = "None" ;
> :title = "NCL: convert-OGR-to-netCDF" ;
> }
>
> I am not sure how to use this information, or if this is even the
> information I should be getting, to define the study region when extracting
> data from my global forecast dataset. I am fairly sure the shapefile is
> correct. Opening it again in QGIS showed the four states with their
> outlines and filling, and nothing else.
>
> I appreciate any help!
>
> Thank you very much,
> Toni
>
>
> *Toni Klemm*
> Ph.D. Candidate
> The University of Oklahoma
> South Central Climate Science Center
> phone: 405 325 1272 <(405)%20325-1272>
> www.toni-klemm.de
> Early Career Climate Forum <https://www.eccforum.org>
> Twitter: @toniklemm <https://twitter.com/ToniKlemm>
>
>
>
>
>
>
>
> _______________________________________________
> 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/20170524/336fa67d/attachment-0001.html 


More information about the ncl-talk mailing list