<div dir="ltr"><div class="gmail_default" style="font-size:small">If you have lat/lon coordinate arrays attached to your data, then can try the "lonFlip" function to convert your data to be -180 to 180 longitude:</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style=""><a href="http://www.ncl.ucar.edu/Document/Functions/Contributed/lonFlip.shtml">http://www.ncl.ucar.edu/Document/Functions/Contributed/lonFlip.shtml</a><br></div><div class="gmail_default" style=""><br></div><div class="gmail_default" style="">If you don't have coordinate arrays, but instead are using the special lat2d/lon2d or lat1d/lon1d attributes, then you can try the "where" function:</div><div class="gmail_default" style=""> </div><div class="gmail_default" style=""><span style="font-size:12.8000001907349px">NEE_AVG@lon2d = </span>where(<span style="font-size:12.8000001907349px">lon2d</span>.gt.180, <span style="font-size:12.8000001907349px">lon2d - </span>360, <span style="font-size:12.8000001907349px">lon2d</span>)<br></div><div class="gmail_default" style="">
<p class="">Note: I don't know what your longitude array is called. I'm just using "lon2d" as an example here. You can operate on the attribute directly:</p><p class=""></p><div class="gmail_default" style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"></div><p></p><div class="gmail_default" style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><span style="font-size:12.8000001907349px">NEE_AVG@lon2d = </span>where(<span style="font-size:12.8000001907349px">NEE_AVG @</span><span style="font-size:12.8000001907349px">lon2d</span>.gt.180, <span style="font-size:12.8000001907349px">NEE_AVG @</span><span style="font-size:12.8000001907349px">lon2d - </span>360,<span style="font-size:12.8000001907349px"> NEE_AVG@</span><span style="font-size:12.8000001907349px">lon2d</span>)</div><div class="gmail_default" style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><br></div><div class="gmail_default" style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">You will also need to update your minlon/maxlon attributes to be in -180 to 180</div><div class="gmail_default" style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><br></div><div class="gmail_default" style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><span style="font-size:12.8000001907349px"> opt@minlon = -130 ; 230 - 360</span><br style="font-size:12.8000001907349px"><span style="font-size:12.8000001907349px"> opt@maxlon = -65 ; 295 - 360</span><br></div><div class="gmail_default" style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><span style="font-size:12.8000001907349px"><br></span></div><div class="gmail_default" style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><span style="font-size:12.8000001907349px"><br></span></div><div class="gmail_default" style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">--Mary</div><div class="gmail_default" style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><br></div><p class=""><br></p></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Sat, Jul 4, 2015 at 9:34 PM, Ming Chen <span dir="ltr"><<a href="mailto:chen1718@umn.edu" target="_blank">chen1718@umn.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div>I think I know why it is happening... The data I'm trying to mask has the longitude from 0 to 357.5, while the shapefile has the longitude from -179.1 to 179.8...<br><br></div>Does anyone has suggestion how I can fix that? Thanks!<span class="HOEnZb"><font color="#888888"><br><br></font></span></div><span class="HOEnZb"><font color="#888888">Ming<br><div><div><br><br></div></div></font></span></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">On Sat, Jul 4, 2015 at 10:19 PM, Ming Chen <span dir="ltr"><<a href="mailto:chen1718@umn.edu" target="_blank">chen1718@umn.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div><div>Hi all,<br><br></div>I was trying to mask the contiguous United States using a shape file and the script "shapefile_mask_data.ncl", but got all missing values.<br><br></div>I used ncl 6.2.1. The script I used is here:<br><br>;Begins to calculate US averaged NEE<br> shp_filename = "coastl_usa.shp"<br> opt = True<br> opt@minlat = 20<br> opt@maxlat = 50<br> opt@minlon = 230<br> opt@maxlon = 295<br> opt@debug = True<br> opt@keep = True<br> opt@loop_check = True<br> data_mask = shapefile_mask_data(NEE_AVG,shp_filename,opt)<br> NEE_scalar = wgt_areaave(data_mask,1.,1.,0) ;averaged NEE over the United States<br><br><br></div>And here is the message I got:<br>(0) ==================================================<br>(0) Shapefile: coastl_usa.shp<br>(0) Areas of interest: the whole shapefile<br>(0) min_lat_chk: 20<br>(0) max_lat_chk: 50<br>(0) min_lon_chk: 230<br>(0) max_lon_chk: 295<br>(0) min_lat_data: -90<br>(0) max_lat_data: 90<br>(0) min_lon_data: 0<br>(0) max_lon_data: 357.5<br>(0) 13824 data values originally<br>(0) Will keep data values inside given shapefile areas<br>(0) ==================================================<br>(0) 0 data values kept<br>(0) shapefile_mask_data: elapsed time: 0.930859 CPU seconds.<br>(0) ==================================================<br><div><br></div><div>I can see there are 13824 data points in my NEE_AVG data. And I have plot that without problem. Why there was no data masked?<br><br></div><div>Thanks,<br></div><div>Ming<span><font color="#888888"><br></font></span></div><span><font color="#888888"><div><br clear="all"><div><div><div><div><br>-- <br><div>Department of Soil, Water and Climate<br>439 Borlaug Hall 1991 Upper Buford Cir.<br>St. Paul 55108<br>MN USA<div>Office: <a href="tel:612-624-1645" value="+16126241645" target="_blank">612-624-1645</a><br><div><a href="http://www.biometeorology.umn.edu/people_ming.php" target="_blank">http://www.biometeorology.umn.edu/people_ming.php</a>
</div></div></div>
</div></div></div></div></div></font></span></div>
</blockquote></div><br><br clear="all"><br>-- <br><div>Department of Soil, Water and Climate<br>439 Borlaug Hall 1991 Upper Buford Cir.<br>St. Paul 55108<br>MN USA<div>Office: <a href="tel:612-624-1645" value="+16126241645" target="_blank">612-624-1645</a><br><div><a href="http://www.biometeorology.umn.edu/people_ming.php" target="_blank">http://www.biometeorology.umn.edu/people_ming.php</a>
</div></div></div>
</div>
</div></div><br>_______________________________________________<br>
ncl-talk mailing list<br>
<a href="mailto:ncl-talk@ucar.edu">ncl-talk@ucar.edu</a><br>
List instructions, subscriber options, unsubscribe:<br>
<a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" rel="noreferrer" target="_blank">http://mailman.ucar.edu/mailman/listinfo/ncl-talk</a><br>
<br></blockquote></div><br></div>