[ncl-talk] question using shapefile to select data

Guido Cioni guidocioni at gmail.com
Tue Oct 31 09:31:27 MDT 2017


Yes,
I would suggest you to first create a netcdf file with the mask (otherwise using the shapefile every time takes too much time): see example 11 here https://www.ncl.ucar.edu/Applications/shapefiles.shtml <https://www.ncl.ucar.edu/Applications/shapefiles.shtml>. 

Once you have the netcdf file with the mask you can mask the data and compute the average simply as 

;mask data over italy 
ndvi_it=mask(ndvi_it, ita_mask.eq.1, ndvi at _FillValue)
ndvi_avg=dim_avg_n_Wrap(ndvi_it,(/1,2/))

Cheers 

> Il giorno 31 ott 2017, alle ore 12:07, Damjan Jelić <damjan.jelic at fmf.uni-lj.si> ha scritto:
> 
> Dear NCL support,
> 
> supose i have 2D georef. data and i have shape file of one country borders within that 2D field. Is it possible to use that shape file to approximately cut out data from that 2D field and do some math with it?
> To visualize the question, Im attaching a figure containing lightning-strikes of some period on 1x1km^2 resolution over Croatia and im interested for begining how much of strikes occurred over land part of Croatia.
> 
> Best,
> Damjan<lightning_test.png>_______________________________________________
> 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/20171031/5d4ba981/attachment.html>


More information about the ncl-talk mailing list