<div dir="ltr"><div>[1] <b>setfileoption</b> is placed <b>BEFORE </b>opening the nc file<br></div>[2] the <b>missing_value</b> attribute is associated with 'ndvi' not 'NDVI'<br>=================================================== <br><div>;---Read NDVI data to contour and mask<br> dir = "./"<br> filename = "ndvi3g_geo_v1_1985_0106.nc4"<br><br> setfileoption("nc","MissingToFillValue", False) ; eliminate *warning* message<br> f = addfile(dir+filename,"r")<br> ndvi = f->ndvi(0,:,:)<br><br> ndvi&lat@units = "degrees_north" ; Add units attribute<br> ndvi&lon@units = "degrees_east"<br> ndvi@_FillValue = toshort(ndvi@missing_value) ; match typeof 'ndvi' (netCDF rule)<br> printVarSummary(ndvi)<br> printMinMax(ndvi,0)<br><br> NDVI = floor(ndvi/10)/1000 ; no meta data<br> copy_VarCoords(ndvi, NDVI) ; add coordinate meta data<br> NDVI@long_name = "Normalized Difference Vegetation Index" ; add a long_name<br> printVarSummary(NDVI)<br> printMinMax(NDVI,0)<br></div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, May 11, 2018 at 7:02 AM, Md. Jalal Uddin <span dir="ltr"><<a href="mailto:dmjalal90@gmail.com" target="_blank">dmjalal90@gmail.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">I am still getting following warnings though I put <div><span class=""> setfileoption("nc","<wbr>MissingToFillValue", False)</span><div> NDVI@_FillValue = toshort(NDVI@missing_value) ; match typeof 'ndvi' (netCDF rule).</div><div><br></div><div><br></div><div><div>warning:NetOpenFile: MissingToFillValue option set True, but missing_value attribute and data variable (ndvi) types differ: not adding virtual _FillValue attribute</div><div>warning:Attempt to reference attribute (missing_value) which is undefined</div><div>warning:toshort: there are 1 int less than SHRT_MIN, which has been flagged missing.</div></div><div><br></div><div>Please find the script herewith. Please help me to fix these problems.</div><div><br></div><div><br></div></div></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">On Thu, May 10, 2018 at 10:02 PM, Dennis Shea <span dir="ltr"><<a href="mailto:shea@ucar.edu" target="_blank">shea@ucar.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>ncl 1> ndvi = f->ndvi <wbr> <br>ncl 2> print("typeof(ndvi)="+typeof(n<wbr>dvi)) ; <b>"short"</b><br>ncl 3> print("typeof(ndvi@missing_val<wbr>ue)="+typeof(ndvi@missing_valu<wbr>e)) ; <b>"double"</b><br><br></div><div>The variable (ndvi) does not have an <b>_FillValue</b> attribute associated with it. By default, NCL tries to be 'smart' and set the variable's (ndvi) <b>missing_value</b> to<b> _FillValue</b>. However, by netCDF (hence, NCL) rule the type of the variable (ndvi) and the type of _FillValue attribute should match. They do not. Again, one variable is type "short" the other is type "double". <br><br>The issue is explicitly mentioned in the error message.<span><br><br>MissingToFillValue option set True, but missing_value attribute and data
variable (ndvi) types differ: not adding virtual _FillValue attribute<br><br></span></div><div>Please read the text associated with:<br><a href="https://www.ncl.ucar.edu/Document/Functions/Built-in/setfileoption.shtml" target="_blank">https://www.ncl.ucar.edu/Docum<wbr>ent/Functions/Built-in/setfile<wbr>option.shtml</a><br></div><div><b> MissingToFillValue<br><br></b></div><div>You can explicitly set this option to False"<br><pre><strong> setfileoption</strong>("nc","<b>MissingToF<wbr>illValue</b>", False)<br><br></pre><pre>This will eliminate the warning message.<br></pre></div>Still, you are left with no way to identify _FillValue. This is the attribute NCL recognizes.<br></div><div>The following script on the NDVI page explicitly converts the type double missing_value (=5000.0d)<br></div><div>to type short.<br></div><div><br></div>ndvi_2.ncl<br><div><pre> NDVI = f->ndvi ; original unpacked values
NDVI@_FillValue = toshort(NDVI@missing_value) ; match typeof 'ndvi' (netCDF rule)<br><br></pre><pre>You need to do this for masking.<br><br></pre><pre>Good Luck <br></pre></div></div><div class="m_6935206500949063829HOEnZb"><div class="m_6935206500949063829h5"><div class="gmail_extra"><br><div class="gmail_quote">On Thu, May 10, 2018 at 6:00 AM, Md. Jalal Uddin <span dir="ltr"><<a href="mailto:dmjalal90@gmail.com" target="_blank">dmjalal90@gmail.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">Thank you for your help. Mary's suggestions are working now. However, I am getting following errors.<div><br></div><div>MissingToFillValue option set True, but missing_value attribute and data variable (ndvi) types differ: not adding virtual _FillValue attribute<br></div><div><br></div><div>I also went to the NCL NDVI examples page (<a href="https://www.ncl.ucar.edu/Applications/ndvi.shtml" target="_blank">https://www.ncl.ucar.edu/Appl<wbr>ications/ndvi.shtml</a>) and tried to follow Example 2 that suggested by <span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:12.8px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:700;letter-spacing:normal;text-align:left;text-indent:0px;text-transform:none;white-space:nowrap;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">Dennis Shea. </span>I got output but received the same problem.</div><div><br></div><div>How could I solve the problem?</div><div><br></div></div><div class="m_6935206500949063829m_-8342735282905003007HOEnZb"><div class="m_6935206500949063829m_-8342735282905003007h5"><div class="gmail_extra"><br><div class="gmail_quote">On Wed, May 9, 2018 at 11:54 PM, Dennis Shea <span dir="ltr"><<a href="mailto:shea@ucar.edu" target="_blank">shea@ucar.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><div><div>If you go to NCL's Examples page:<br><br> <a href="https://www.ncl.ucar.edu/Applications/" target="_blank">https://www.ncl.ucar.edu/Appli<wbr>cations/</a><br><br></div>Under 'Datasets', click 'NDVI'<br><br></div>There are three examples of differently sourced NDVI data sets.<br><br></div>The 'GIMMS' version is Example 2.<br><br></div>Please read the associated text description and the actual script.<br></div>As noted, the netCDF file is poorly written.<br><div><br><br></div></div><div class="m_6935206500949063829m_-8342735282905003007m_7951263503269140194HOEnZb"><div class="m_6935206500949063829m_-8342735282905003007m_7951263503269140194h5"><div class="gmail_extra"><br><div class="gmail_quote">On Wed, May 9, 2018 at 8:14 AM, Mary Haley <span dir="ltr"><<a href="mailto:haley@ucar.edu" target="_blank">haley@ucar.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 class="gmail_default" style="font-size:small">Hi Jalal,</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">I took a look at one of these NDVI data files, and noticed that the lat/lon coordinate arrays on the file have no attributes, which is not good.</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">These arrays should at least have "units" and "long_name" attributes and units should be something like "degrees_north" and "degrees_east". For rectilinear data (data with lat/lon coordinate arrays), NCL needs these units to be something that indicates they are in degrees, or otherwise it can't be sure it is plotting the data correctly.<br></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 data when you get errors like this. You do have:</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">printVarSummary(ndvi)</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">but I also added:</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">printVarSummary(ndvi&lat)</div><div class="gmail_default" style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-decoration-style:initial;text-decoration-color:initial">printVarSummary(ndvi&lon)</div><div class="gmail_default" style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-decoration-style:initial;text-decoration-color:initial"><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-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-decoration-style:initial;text-decoration-color:initial">in order to look at the lat/lon arrays to see what the units were and you can see there are none:</div><div class="gmail_default" style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-decoration-style:initial;text-decoration-color:initial"><br></div><div class="gmail_default" style="text-align:start;text-indent:0px;text-decoration-style:initial;text-decoration-color:initial"><div class="gmail_default">Variable: lat (coordinate)</div><div class="gmail_default">Type: double</div><div class="gmail_default">Total Size: 17280 bytes</div><div class="gmail_default"> 2160 values</div><div class="gmail_default">Number of Dimensions: 1</div><div class="gmail_default">Dimensions and sizes:<span style="white-space:pre-wrap"> </span>[lat | 2160]</div><div class="gmail_default">Coordinates: </div><div class="gmail_default">Number Of Attributes: 0</div><div class="gmail_default"><br></div></div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">To fix this, I did this after reading in ndvi:</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small"><div class="gmail_default"><font face="monospace, monospace"> ndvi = f->ndvi(0,:,:)</font></div><div class="gmail_default"><font face="monospace, monospace"> ndvi&lat@units = "degrees_north" ; Fix the units</font></div><div class="gmail_default"><font face="monospace, monospace"> ndvi&lon@units = "degrees_east"</font></div><div class="gmail_default"><font face="monospace, monospace"> printVarSummary(ndvi)</font></div><div class="gmail_default"><br>I also had to remove the reference to "ndvi@long_name" in a later title string, because ndvi doesn't have a long_name attribute.</div><div class="gmail_default"><br></div><div class="gmail_default">--Mary</div></div></div><div class="gmail_extra"><br><div class="gmail_quote"><div><div class="m_6935206500949063829m_-8342735282905003007m_7951263503269140194m_2976767956301163672h5">On Wed, May 9, 2018 at 3:44 AM, Md. Jalal Uddin <span dir="ltr"><<a href="mailto:dmjalal90@gmail.com" target="_blank">dmjalal90@gmail.com</a>></span> wrote:<br></div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="m_6935206500949063829m_-8342735282905003007m_7951263503269140194m_2976767956301163672h5"><div dir="ltr">Hi all,<div><br></div><div>I tried to plot gimms ndvi (<span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline"><a href="https://ecocast.arc.nasa.gov/data/pub/gimms/3g.v1/" target="_blank">https://ecocast.ar<wbr>c.nasa.gov/data/pub/gimms/3g.v<wbr>1/</a>) </span>data by masking. I am getting following errors. I used <span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">copy_VarCoords(ndvi,ndvi_mask) command to fix it but failed. Please help to solve this problem. Please find my script in the attachment.</span></div><div><br></div><div><div>(0)<span style="white-space:pre-wrap"> </span>check_for_y_lat_coord: Warning: Data either does not contain a valid latitude coordinate array or doesn't contain one at all.</div><div>(0)<span style="white-space:pre-wrap"> </span>A valid latitude coordinate array should have a 'units' attribute equal to one of the following values: </div><div>(0)<span style="white-space:pre-wrap"> </span> 'degrees_north' 'degrees-north' 'degree_north' 'degrees north' 'degrees_N' 'Degrees_north' 'degree_N' 'degreeN' 'degreesN' 'deg north'</div><div>(0)<span style="white-space:pre-wrap"> </span>check_for_lon_coord: Warning: Data either does not contain a valid longitude coordinate array or doesn't contain one at all.</div><div>(0)<span style="white-space:pre-wrap"> </span>A valid longitude coordinate array should have a 'units' attribute equal to one of the following values: </div><div>(0)<span style="white-space:pre-wrap"> </span> 'degrees_east' 'degrees-east' 'degree_east' 'degrees east' 'degrees_E' 'Degrees_east' 'degree_E' 'degreeE' 'degreesE' 'deg east'</div><div>(0)<span style="white-space:pre-wrap"> </span>check_for_y_lat_coord: Warning: Data either does not contain a valid latitude coordinate array or doesn't contain one at all.</div><div>(0)<span style="white-space:pre-wrap"> </span>A valid latitude coordinate array should have a 'units' attribute equal to one of the following values: </div><div>(0)<span style="white-space:pre-wrap"> </span> 'degrees_north' 'degrees-north' 'degree_north' 'degrees north' 'degrees_N' 'Degrees_north' 'degree_N' 'degreeN' 'degreesN' 'deg north'</div><div>(0)<span style="white-space:pre-wrap"> </span>check_for_lon_coord: Warning: Data either does not contain a valid longitude coordinate array or doesn't contain one at all.</div><div>(0)<span style="white-space:pre-wrap"> </span>A valid longitude coordinate array should have a 'units' attribute equal to one of the following values: </div><div>(0)<span style="white-space:pre-wrap"> </span> 'degrees_east' 'degrees-east' 'degree_east' 'degrees east' 'degrees_E' 'Degrees_east' 'degree_E' 'degreeE' 'degreesE' 'deg east'</div><div>warning:Attempt to reference attribute (long_name) which is undefined</div><div><br></div><div>Cheers,</div><div>Jalal</div>-- <br><div class="m_6935206500949063829m_-8342735282905003007m_7951263503269140194m_2976767956301163672m_-9060124207853412787m_-8868263182315960922gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><font size="2" color="#000000"><b>Md. Jalal Uddin</b></font></div><div dir="ltr">MSc in Applied Meteorology (English Language)<br>Nanjing University of Information, Science and Technology, China</div><div dir="ltr">Jasmine Jiangsu Government Scholar<br>Cell: +8613260859092</div><div>Office: Beichen Building, School of Geography and Remote Sensing, Room No. 406</div><div dir="ltr"><font style="background-color:rgb(255,255,255)" color="#000000"><b><br></b></font></div><div dir="ltr"><font style="background-color:rgb(255,255,255)" color="#000000"><b>AND </b></font></div><div dir="ltr">B.Sc. in Disaster Management (Hons.) </div><div dir="ltr">Patuakhali Science and Technology University, Bangladesh.<br>Cell: +8801792052662, +8801838613203 </div><div dir="ltr"><font size="2">Email:<b> </b><a href="mailto:dmjalal90@gmail.com" target="_blank">dmjalal90@gmail.com</a><br>Web: <a href="http://www.dmjalal90.weebly.com" target="_blank">www.dmjalal90.weebly.com</a> <br>Facebook: jalal.hossen.39 <br>LinkedIn: <a href="https://bd.linkedin.com/in/md-jalal-uddin-80a026b0" target="_blank">https://bd.linkedin.com/in/md-<wbr>jalal-uddin-80a026b0</a> <br>Twitter: dmjalal90 <br>Skype: dmjalal90</font><br></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div>
</div></div>
<br></div></div>______________________________<wbr>_________________<br>
ncl-talk mailing list<br>
<a href="mailto:ncl-talk@ucar.edu" target="_blank">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/mailma<wbr>n/listinfo/ncl-talk</a><br>
<br></blockquote></div><br></div>
<br>______________________________<wbr>_________________<br>
ncl-talk mailing list<br>
<a href="mailto:ncl-talk@ucar.edu" target="_blank">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/mailma<wbr>n/listinfo/ncl-talk</a><br>
<br></blockquote></div><br></div>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="m_6935206500949063829m_-8342735282905003007m_7951263503269140194gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><font size="2" color="#000000"><b>Md. Jalal Uddin</b></font></div><div dir="ltr">MSc in Applied Meteorology (English Language)<br>Nanjing University of Information, Science and Technology, China</div><div dir="ltr">Jasmine Jiangsu Government Scholar<br>Cell: +8613260859092</div><div>Office: Beichen Building, School of Geography and Remote Sensing, Room No. 406</div><div dir="ltr"><font style="background-color:rgb(255,255,255)" color="#000000"><b><br></b></font></div><div dir="ltr"><font style="background-color:rgb(255,255,255)" color="#000000"><b>AND </b></font></div><div dir="ltr">B.Sc. in Disaster Management (Hons.) </div><div dir="ltr">Patuakhali Science and Technology University, Bangladesh.<br>Cell: +8801792052662, +8801838613203 </div><div dir="ltr"><font size="2">Email:<b> </b><a href="mailto:dmjalal90@gmail.com" target="_blank">dmjalal90@gmail.com</a><br>Web: <a href="http://www.dmjalal90.weebly.com" target="_blank">www.dmjalal90.weebly.com</a> <br>Facebook: jalal.hossen.39 <br>LinkedIn: <a href="https://bd.linkedin.com/in/md-jalal-uddin-80a026b0" target="_blank">https://bd.linkedin.com/in/md-<wbr>jalal-uddin-80a026b0</a> <br>Twitter: dmjalal90 <br>Skype: dmjalal90</font><br></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div>
</div>
</div></div></blockquote></div><br></div>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="m_6935206500949063829gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><font size="2" color="#000000"><b>Md. Jalal Uddin</b></font></div><div dir="ltr">MSc in Applied Meteorology (English Language)<br>Nanjing University of Information, Science and Technology, China</div><div dir="ltr">Jasmine Jiangsu Government Scholar<br>Cell: +8613260859092</div><div>Office: Beichen Building, School of Geography and Remote Sensing, Room No. 406</div><div dir="ltr"><font style="background-color:rgb(255,255,255)" color="#000000"><b><br></b></font></div><div dir="ltr"><font style="background-color:rgb(255,255,255)" color="#000000"><b>AND </b></font></div><div dir="ltr">B.Sc. in Disaster Management (Hons.) </div><div dir="ltr">Patuakhali Science and Technology University, Bangladesh.<br>Cell: +8801792052662, +8801838613203 </div><div dir="ltr"><font size="2">Email:<b> </b><a href="mailto:dmjalal90@gmail.com" target="_blank">dmjalal90@gmail.com</a><br>Web: <a href="http://www.dmjalal90.weebly.com" target="_blank">www.dmjalal90.weebly.com</a> <br>Facebook: jalal.hossen.39 <br>LinkedIn: <a href="https://bd.linkedin.com/in/md-jalal-uddin-80a026b0" target="_blank">https://bd.linkedin.com/in/md-<wbr>jalal-uddin-80a026b0</a> <br>Twitter: dmjalal90 <br>Skype: dmjalal90</font><br></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div>
</div>
</div></div></blockquote></div><br></div>