<div dir="ltr"><div>Tabish, on the "Shapefiles" example page, there is a note near the top.  I think this might be the problem.  Check the latitude ranges on your shapefile and grids.<br><br>"Important note: The shapefile_mask_data function is a powerful function used by many scripts on this page. In order for your data to be masked correctly using this function, your longitude values must be in the same range as the longitude values on the shapefile. Most shapefile longitude values are in the range -180 to 180. You can use the print_shapefile_info procedure above to print this information."<br></div><div><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Nov 30, 2022 at 8:24 AM Tabish Ansari via ncl-talk <<a href="mailto:ncl-talk@mailman.ucar.edu">ncl-talk@mailman.ucar.edu</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div style="font-family:"trebuchet ms",sans-serif">Hi</div><div style="font-family:"trebuchet ms",sans-serif"><br></div><div style="font-family:"trebuchet ms",sans-serif">I'm trying to write out masks for 3 distinct regions: Asia (AS), North America (NA) and Europe (EU) for two grids: a high resolution grid with greenwich meridian in the middle and a low resolution grid with greenwich meridian at the left edge. The shapefile mask data function seems to work fine and gives a "success" message in the end, however, while the output file contains correct masks for all the 3 regions for the high-resolution grid, the masks are incomplete for the low-resolution grid - anything west of Greenwich meridian is missing. Can this be due to the low-res grid not being centered at 0deg? The script is copied below:</div><div style="font-family:"trebuchet ms",sans-serif"><br></div><div style="font-family:"trebuchet ms",sans-serif">======================================================================================</div><div style="font-family:"trebuchet ms",sans-serif">load "./shapefile_utils.ncl"<br><br>begin<br><br>sname = "/work/users/tan/mask/ref-countries-2020-01m.shp/CNTR_RG_01M_2020_4326.shp/CNTR_RG_01M_2020_4326.shp"<br><br>correctedlist_AS = (/"Aksai Chin","Arunachal Pradesh","Afghanistan","Bangladesh","Bhutan","Brunei","Cambodia","China","China/India","Jammu Kashmir","Hong Kong","India","Indonesia","Japan","Kazakhstan","Kyrgyzstan","Laos","Macao","Malaysia","Maldives","Mongolia","Myanmar/Burma","Nepal","North Korea","Pakistan","Papua New Guinea","Philippines","Singapore","South Korea","Sri Lanka","Taiwan_Province of China","Tajikistan","Thailand","Timor-Leste","Turkmenistan","Uzbekistan","VietNam"/)<br><br>correctedlist_NA = (/"Canada","Saint Pierre and Miquelon","United States"/)<br><br>correctedlist_EU = (/"Albania","Armenia","Austria","Azerbaijan","Belarus","Belgium","Bosnia and Herzegovina","Bulgaria","Croatia","Cyprus","Czechia","Denmark","Estonia","Faroes","Finland","France","Georgia","Germany","Gibraltar","Greece","Greenland","Hungary","Iceland","Ireland","Italy","Latvia","Lithuania","Luxembourg","North Macedonia","Malta","Moldova","Norway","Poland","Portugal","Romania","Russian Federation","Serbia","Slovakia","Slovenia","Spain","Sweden","Switzerland","Türkiye","Ukraine","United Kingdom"/)<br><br>areas_of_interest = correctedlist_AS<br><br>data_lowres  = addfile("/data/nosync/emissions/HTAPv3-Emissions-tan_regridMC/edgar_HTAPv3_2006_NMVOC.nc","r")<br>data_highres = addfile("/data/nosync/emissions/HTAPv3-Fluxes-tan/edgar_HTAPv3_2006_NMVOC.nc","r")<br><br>;system("rm VOCregionmask2.nc")<br>VOCregionmask = addfile("VOCregionmask.nc","w")<br><br>;---Read any 3d variable and lat/lon coordinates off wrfchemi file.<br>  emislow    = data_lowres->HTAPv3_1_International_Shipping(0,:,:)<br>  emishigh   = data_highres->HTAPv3_1_International_Shipping(0,:,:)<br><br>;---Set all temperature values to 0 except for those over areas of interest which will be equal to 1.<br>  opt             = True<br>  opt@debug       = True<br>  opt@shape_var   = "NAME_ENGL"<br>  opt@shape_names = areas_of_interest<br>  opt@return_mask = True               ; THIS RETURNS A MATRIX OF 0 AND 1 INSTEAD OF MASKED DATA<br></div><div style="font-family:"trebuchet ms",sans-serif"><br></div><div style="font-family:"trebuchet ms",sans-serif">  print("masking lowres data...")<br></div><div style="font-family:"trebuchet ms",sans-serif">  emislowresmask  = shapefile_mask_data(emislow,sname,opt)<br><br>  print("masking highres temperature data...")<br>  emishighresmask   = shapefile_mask_data(emishigh,sname,opt)<br><br>  VOCregionmask->AS_lowres  = (/emislowresmask/)<br>  VOCregionmask->AS_highres = (/emishighresmask/)<br><br>print("Success!!!")<br><br>end<br></div><div style="font-family:"trebuchet ms",sans-serif"><br></div><div style="font-family:"trebuchet ms",sans-serif">========================================================================</div><div style="font-family:"trebuchet ms",sans-serif"><br></div><div style="font-family:"trebuchet ms",sans-serif">Thanks a lot.</div><div style="font-family:"trebuchet ms",sans-serif"><br></div><div style="font-family:"trebuchet ms",sans-serif">with best regards,</div><div style="font-family:"trebuchet ms",sans-serif"><br></div><div style="font-family:"trebuchet ms",sans-serif">Tabish</div><div><div dir="ltr"><div dir="ltr"><div><font face="trebuchet ms, sans-serif" color="#666666">-------------------------------<br><span style="background-color:rgb(255,255,255)">Dr Tabish Ansari</span></font></div><div><font face="trebuchet ms, sans-serif" color="#666666">Research Associate </font></div><div><font face="trebuchet ms, sans-serif" color="#666666">Air Quality Modelling Group</font></div><div><span style="background-color:rgb(255,255,255)"><span style="font-weight:normal"><font face="trebuchet ms, sans-serif" color="#666666">IASS-Potsdam </font></span></span></div><div><font face="trebuchet ms, sans-serif" color="#666666">Germany</font></div></div></div></div></div>
</blockquote></div></div>