<html><head><meta http-equiv="Content-Type" content="text/html; charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">Why not? I think the example on the website it's pretty clear :) <div class="">You should be a little bit more specific...which aspect is not clear to you? </div><div class=""><br class=""></div><div class="">I'm attaching an even simpler script that I used to produce a netcdf mask of a region in Italy (Toscana) using shapefile data. You need to load the shapefile_utils.ncl file first!!! (see here <a href="https://www.ncl.ucar.edu/Applications/shapefiles.shtml" class="">https://www.ncl.ucar.edu/Applications/shapefiles.shtml</a>) </div><div class=""><br class=""></div><div class=""><div class=""><font face="Menlo" class="">;load shapefile</font></div><div class=""><font face="Menlo" class="">f_state = addfile("shapefiles/ITA_adm_shp/ITA_adm0.shp","r")</font></div><div class=""><font face="Menlo" class="">lon_shp = f_state->x</font></div><div class=""><font face="Menlo" class="">lat_shp = f_state->y</font></div><div class=""><font face="Menlo" class=""><br class=""></font></div><div class=""><font face="Menlo" class="">;load data, in this case MODIS NDVI</font></div><div class=""><font face="Menlo" class=""><div class="">infile = addfile ("MOD13C2_2000-2017_it_seasanom.nc", "r")</div><div class=""><div class="">ndvi=infile->CMG_0_05_Deg_Monthly_NDVI(0,::-1,:)</div></div></font></div><div class=""><font face="Menlo" class=""><br class=""></font></div><div class=""><font face="Menlo" class="">; Name of the output file </font></div><div class=""><div class=""><font face="Menlo" class="">mask_fname = "toscana_mask.nc"</font></div><div class=""><font face="Menlo" class=""><br class=""></font></div><div class=""><font face="Menlo" class=""> opt = True</font></div><div class=""><font face="Menlo" class=""> opt@return_mask = True</font></div><div class=""><font face="Menlo" class=""> opt@debug = True</font></div><div class=""><font face="Menlo" class=""> opt@shape_var = "NAME_1"</font></div><div class=""><font face="Menlo" class=""> opt@shape_names = "Toscana"</font></div><div class=""><font face="Menlo" class=""><br class=""></font></div><div class=""><font face="Menlo" class=""> toscana_mask = shapefile_mask_data(ndvi,f_state,opt)</font></div><div class=""><font face="Menlo" class=""><br class=""></font></div><div class=""><font face="Menlo" class="">;Write new mask to file</font></div><div class=""><font face="Menlo" class=""><br class=""></font></div><div class=""><font face="Menlo" class=""> system("rm -f " + mask_fname)</font></div><div class=""><font face="Menlo" class=""> fout = addfile(mask_fname,"c")</font></div><div class=""><font face="Menlo" class=""> fout->TSC_mask = toscana_mask</font></div></div><div class=""><br class=""></div><div class="">And then use it with </div><div class=""><br class=""></div><div class=""><div class=""> <font face="Menlo" class=""> fmask = addfile("toscana_mask.nc","r")</font></div><div class=""><font face="Menlo" class=""> tsc_mask = fmask->TSC_mask</font></div></div><div class=""><font face="Menlo" class=""><br class=""></font></div><div class=""><div class=""><font face="Menlo" class=""> ndvi=mask(ndvi, tsc_mask.eq.1, ndvi@_FillValue)</font></div></div><div class=""><br class=""></div><div class=""><div class=""><div><br class=""><blockquote type="cite" class=""><div class="">On 26. Apr 2018, at 16:29, WUJIE <<a href="mailto:393069045@qq.com" class="">393069045@qq.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div class=""><br class=""></div><div class=""><div style="font-family: 'lucida Grande', Verdana, 'Microsoft YaHei'; line-height: 23.8px;" class="">Hi Sir,</div><div style="font-family: 'lucida Grande', Verdana, 'Microsoft YaHei'; line-height: 23.8px;" class=""><br class=""></div><div style="font-family: 'lucida Grande', Verdana, 'Microsoft YaHei'; line-height: 23.8px;" class="">While I have used NCL for some months, I still cannot understand that how to use shapefile to creat a mask nc file.</div><div style="font-family: 'lucida Grande', Verdana, 'Microsoft YaHei'; line-height: 23.8px;" class="">I am now having a basin's shp and I wanna to creat a ncfile as a basin mask. This enables me to calculate the basin mean temperature data using this mask nc (i.e. exclude the values out of the basin)</div><div style="font-family: 'lucida Grande', Verdana, 'Microsoft YaHei'; line-height: 23.8px;" class="">I gave a read here (<span style="line-height: 1.5;" class=""><a href="https://www.ncl.ucar.edu/Applications/Scripts/mask_12.ncl" target="_blank" style="outline: none; cursor: pointer; color: rgb(30, 84, 148);" class="">https://www.<wbr class="">ncl.ucar.edu<wbr class="">/Application<wbr class="">s/Scripts/ma<wbr class="">sk_12.ncl</a>), but this is not clear to me.</span></div><div style="font-family: 'lucida Grande', Verdana, 'Microsoft YaHei'; line-height: 23.8px;" class=""><span style="line-height: 1.5;" class=""><br class=""></span></div><div style="font-family: 'lucida Grande', Verdana, 'Microsoft YaHei'; line-height: 23.8px;" class=""><span style="line-height: 1.5;" class="">Could you please give me an example?</span></div><div style="font-family: 'lucida Grande', Verdana, 'Microsoft YaHei'; line-height: 23.8px;" class=""><span style="line-height: 1.5;" class=""><br class=""></span></div><div style="font-family: 'lucida Grande', Verdana, 'Microsoft YaHei'; line-height: 23.8px;" class="">I attached one shp as an example (see attached). I am really looking forward to your kind help, thanks!</div><div style="font-family: 'lucida Grande', Verdana, 'Microsoft YaHei'; line-height: 23.8px;" class=""><br class=""></div><div style="font-family: 'lucida Grande', Verdana, 'Microsoft YaHei'; line-height: 23.8px;" class="">Jie</div></div>_______________________________________________<br class="">ncl-talk mailing list<br class=""><a href="mailto:ncl-talk@ucar.edu" class="">ncl-talk@ucar.edu</a><br class="">List instructions, subscriber options, unsubscribe:<br class="">http://mailman.ucar.edu/mailman/listinfo/ncl-talk<br class=""></div></blockquote></div><br class=""><div class="">
<div style="color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><br class="Apple-interchange-newline">Guido Cioni</div><div style="color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><a href="http://guidocioni.altervista" class="">http://guidocioni.altervista</a>.org</div>
</div>
<br class=""></div></div></div></body></html>