<div dir="ltr"><div class="gmail_default" style="font-size:small">Amit,</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">It's always important to look at your variables if your NCL script is giving you errors. If you do:</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">printVarSummary(var)</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">you will see that none of the metadata from "IMR_DLY" on the file was carried over to "var", and hence shapefile_mask_data has no lat/lon information to work with.</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">I'm not sure why you are using "doubletofloat", but all of these functions strip off metadata when you use them. </div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">To restore the metadata before you call the masking function, add:</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">copyVarMeta(a->IMR_DLY,var)</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">Really, though, you shouldn't need to use "doubletofloat" unless you are trying to save memory.</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">Also, you don't need this:</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small"><span style="color:rgb(38,114,236);font-family:arial,helvetica,sans-serif;font-size:13.3333px"> lat = a->latitude</span><br style="color:rgb(38,114,236);font-family:arial,helvetica,sans-serif;font-size:13.3333px"><span style="color:rgb(38,114,236);font-family:arial,helvetica,sans-serif;font-size:13.3333px"> lon = a->longitude</span><br></div><div class="gmail_default" style="font-size:small"><span style="color:rgb(38,114,236);font-family:arial,helvetica,sans-serif;font-size:13.3333px"><br></span></div><div class="gmail_default" style="font-size:small">because once you copy over the metadata, the "latitude" and "longitude" arrays will automatically be carried along with "var", and you can access the arrays with "var&latitude" and "var&longitude".</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">--Mary</div><div class="gmail_default" style="font-size:small"><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Sep 15, 2016 at 4:32 AM, Amit Kumar <span dir="ltr"><<a href="mailto:amitkumar.777@hotmail.com" target="_blank">amitkumar.777@hotmail.com</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 style="font-size:10pt;color:#2672ec;background-color:#ffffff;font-family:Arial,Helvetica,sans-serif">
<p>Hi All,</p>
<p><br>
</p>
<p>I've a gridded data & I want to mask it while using shapefile. But it is not taking it as a grid and giving error: <span style="color:rgb(255,0,0)">shapefile_mask_data: Error: not a valid rectilinear, curvilinear, or unstructured grid</span></p>
<p><br>
</p>
<p></p>
<div> left_longitude : 30.05<br>
right_longitude : 120.05<br>
upper_latitude : 40.05<br>
lower_latitude : -39.95<br>
lat_interval : 0.1<br>
lon_interval : 0.1<br>
NCO : "4.5.4"<br>
CDO : Climate Data Operators version 1.7.0 (<a href="http://mpimet.mpg.de/cdo" target="_blank">http://mpimet.mpg.de/cdo</a>)<br>
dimensions:<br>
longitude = 300<br>
latitude = 380<br>
time = 1 // unlimited<br>
variables:<br>
double longitude ( longitude )<br>
standard_name : longitude<br>
long_name : longitude<br>
units : degrees_east<br>
axis : X<br>
<br>
double latitude ( latitude )<br>
standard_name : latitude<br>
long_name : latitude<br>
units : degrees_north<br>
axis : Y<br>
<br>
double time ( time )<br>
standard_name : time<br>
units : minutes since 2000-1-1 00:00:00<br>
calendar : standard<br>
axis : T<br>
<br>
float IMR_DLY ( time, latitude, longitude )<br>
standard_name : Precipitation<br>
long_name : INSAT Multispectral Rainfall(Daily)<br>
units : mm/day<br>
_FillValue : -999<br>
missing_value : -999<br>
</div>
<p></p>
<p><br>
</p>
<p><br>
</p>
<p><span style="color:rgb(75,165,36)">Now how to convert my data into </span>
<span style="color:rgb(75,165,36)">a valid rectilinear, curvilinear, or unstructured grid so that masking can be performed.</span></p>
<p><span style="color:rgb(75,165,36)"><br>
</span></p>
<p><span style="color:rgb(75,165,36)"></span></p>
<div>var = doubletofloat(a->IMR_DLY)<br>
lat = a->latitude<br>
lon = a->longitude</div>
<span>shp_mask = shapefile_mask_data(var(i,:,:)<wbr>,filename,opt)</span> ------> <span style="color:rgb(255,0,0)">
error here</span>
<p></p>
<p><span style="color:rgb(255,0,0)"><br>
</span></p>
<p><span style="color:rgb(255,0,0)">script is also attached.</span><br>
</p>
</div>
</div>
<br>______________________________<wbr>_________________<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/<wbr>mailman/listinfo/ncl-talk</a><br>
<br></blockquote></div><br></div>