<div dir="ltr"><div class="gmail_default" style="font-size:small">Dear Teng Fei,</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">We always recommend that you look at your data with "printVarSummary" and "printMinMax" if there's something going on that you don't understand.</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">It would look like this in your script:</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default"><div class="gmail_default" style="font-size:small"><font face="monospace, monospace"> f = addfile (dir + "<a href="http://plot_test.nc">plot_test.nc</a>","r")</font></div><div class="gmail_default" style="font-size:small"><font face="monospace, monospace"> u = f->obs_arr</font></div><div class="gmail_default" style="font-size:small"><font face="monospace, monospace"> v = f->hdr_vld ; get u data </font></div><div class="gmail_default" style="font-size:small"><font face="monospace, monospace"> printVarSummary(u)</font></div><div class="gmail_default" style="font-size:small"><font face="monospace, monospace"> printVarSummary(v)<br> printMinMax(u,0)</font></div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">The output looks like this:</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default"><div class="gmail_default"><font face="monospace, monospace">Variable: u</font></div><div class="gmail_default"><font face="monospace, monospace">Type: float</font></div><div class="gmail_default"><font face="monospace, monospace">Total Size: 1880 bytes</font></div><div class="gmail_default"><font face="monospace, monospace"> 470 values</font></div><div class="gmail_default"><font face="monospace, monospace">Number of Dimensions: 2</font></div><div class="gmail_default"><font face="monospace, monospace">Dimensions and sizes:<span class="gmail-Apple-tab-span" style="white-space:pre">        </span>[nobs | 94] x [obs_arr_len | 5]</font></div><div class="gmail_default"><font face="monospace, monospace">Coordinates: </font></div><div class="gmail_default"><font face="monospace, monospace">Number Of Attributes: 8</font></div><div class="gmail_default"><font face="monospace, monospace"> long_name :<span class="gmail-Apple-tab-span" style="white-space:pre">        </span>array of observation values</font></div><div class="gmail_default"><font face="monospace, monospace"> _fill_value :<span class="gmail-Apple-tab-span" style="white-space:pre">        </span>-9999</font></div><div class="gmail_default"><font face="monospace, monospace"> columns :<span class="gmail-Apple-tab-span" style="white-space:pre">        </span>hdr_id gc lvl hgt ob</font></div><div class="gmail_default"><font face="monospace, monospace"> hdr_id_long_name :<span class="gmail-Apple-tab-span" style="white-space:pre">        </span>index of matching header data</font></div><div class="gmail_default"><font face="monospace, monospace"> gc_long_name :<span class="gmail-Apple-tab-span" style="white-space:pre">        </span>grib code corresponding to the observation type</font></div><div class="gmail_default"><font face="monospace, monospace"> lvl_long_name :<span class="gmail-Apple-tab-span" style="white-space:pre">        </span>pressure level (hPa) or accumulation interval (sec)</font></div><div class="gmail_default"><font face="monospace, monospace"> hgt_long_name :<span class="gmail-Apple-tab-span" style="white-space:pre">        </span>height in meters above sea level or ground level (msl or agl)</font></div><div class="gmail_default"><font face="monospace, monospace"> ob_long_name :<span class="gmail-Apple-tab-span" style="white-space:pre">        </span>observation value</font></div><div class="gmail_default"><font face="monospace, monospace"><br></font></div><div class="gmail_default"><font face="monospace, monospace">Variable: v</font></div><div class="gmail_default"><font face="monospace, monospace">Type: character</font></div><div class="gmail_default"><font face="monospace, monospace">Total Size: 3760 bytes</font></div><div class="gmail_default"><font face="monospace, monospace"> 3760 values</font></div><div class="gmail_default"><font face="monospace, monospace">Number of Dimensions: 2</font></div><div class="gmail_default"><font face="monospace, monospace">Dimensions and sizes:<span class="gmail-Apple-tab-span" style="white-space:pre">        </span>[nhdr | 94] x [mxstr | 40]</font></div><div class="gmail_default"><font face="monospace, monospace">Coordinates: </font></div><div class="gmail_default"><font face="monospace, monospace">Number Of Attributes: 2</font></div><div class="gmail_default"><font face="monospace, monospace"> long_name :<span class="gmail-Apple-tab-span" style="white-space:pre">        </span>valid time</font></div><div class="gmail_default"><font face="monospace, monospace"> units :<span class="gmail-Apple-tab-span" style="white-space:pre">        </span>YYYYMMDD_HHMMSS UTC</font></div><div class="gmail_default">
<p class="gmail-p1"><span class="gmail-s1"><font face="monospace, monospace">(0)<span class="gmail-Apple-tab-span">        </span>array of observation values : min=-9999 max=289.55</font></span></p><p class="gmail-p1"><span class="gmail-s1">There are two things to note here:</span></p><p class="gmail-p1"></p><ol><li>The minimum of "u" is -9999 which is not correct. This is because the missing value attribute, "_FillValue" has not been set.<br><br></li><li>Your "v" variable is a character array. You cannot plot character data with gsn_csm_xy.<br></li></ol><p></p></div><div class="gmail_default"><br></div><div class="gmail_default">To fix #1, you need to add this to fix the missing value:</div><div class="gmail_default">
<p class="gmail-p1"><span class="gmail-s1"><font face="monospace, monospace"> u@_FillValue = u@_fill_value</font></span></p><p class="gmail-p1"><span class="gmail-s1">To fix #2, you can plot your data with "gsn_csm_y" which doesn't require an X array. This will use index values starting at 0 on the X axis, and going to "ny-1" where "ny" represents the number of Y values.</span></p><p class="gmail-p1">You can then use the "v" array to label the X axis. This array is a bit strange, as it has the same value for 20 iterations and then increments by one hour. I only grabbed the first 10 columns of this array, and then plotted every 20th value on the X axis.</p><p class="gmail-p1">See the attached script and image.</p><p class="gmail-p1">--Mary</p><p class="gmail-p1"><br></p></div></div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Jun 27, 2017 at 1:20 AM, Teng Fei <span dir="ltr"><<a href="mailto:fay900902@gmail.com" target="_blank">fay900902@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"><span style="font-size:14px">Dear NCL helpdesk,</span><div style="font-size:14px"><div style="font-size:14px">I am using METv5.2 to conduct my research. Now, I encounter one problem. I want to use the output file (<a href="http://plot_test.nc/" target="_blank">plot_test.nc</a>) from ASCII2NC tool to plot a XY plot via NCL 6.3.0. The x-axis is time series, which should be hdr_vld in <a href="http://plot_test.nc/" target="_blank">plot_test.nc</a>. The y-axis is temperature: obs_arr (:,4) in <a href="http://plot_test.nc/" target="_blank">plot_test.nc</a>. When I run the ncl to plot it, some mismatches occurred. After checking, I found this is the problem of hdr_vld couldn't match the observation arrays. Could you help me solve this problem? My file <a href="http://plot_test.nc/" target="_blank">plot_test.nc</a>, and my script have been attached. Thank you!</div><div style="font-size:14px"><br></div><div style="font-size:14px">Yours,</div><div style="font-size:14px">Teng Fei</div></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>