<div dir="ltr"><div class="gmail_default" style="font-size:small">Hi Chris,</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">Whenever you do a calculation with NCL and assign it to a new variable, this causes all metadata, except for the _FillValue attribute (if any), to be stripped off.</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">For example, if "tempC" is a variable containing temperatures in degrees celsius, and it has a "long_name" attribute of "temperature" and a "units" of "degC", then doing this:</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small"><font face="monospace, monospace">tempF = 1.8 * tempC + 32. </font></div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">is going to cause "tempF" to have no attributes at all. When you do this, however:</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small"><font face="monospace, monospace">tempF = tempC</font></div><div class="gmail_default" style="font-size:small"><font face="monospace, monospace">tempF = 1.8 * tempC + 32. </font></div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">then "tempF" is first an exact copy of "tempC", and hence will have all of its metadata attached. When you do the calculation, the metadata will not be stripped from the existing "tempF". </div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">As you pointed out, this is not ideal because now the "units" and potentially other attributes are wrong. </div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">But, if this is the only thing that's wrong, then you can easily fix it with:</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style=""><div class="gmail_default" style="font-size:small"><font face="monospace, monospace">tempF = tempC</font></div><div class="gmail_default" style="font-size:small"><font face="monospace, monospace">tempF = 1.8 * tempC + 32. </font></div><div class="gmail_default" style="font-size:small"><font face="monospace, monospace">tempF@units = "degF" ; Fix the units</font></div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">This is perfectly okay in NCL, but I agree that it's a little odd. </div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">The other way around this is to copy the metadata yourself using "copy_VarMeta":</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style=""><div class="gmail_default" style="font-size:small"><font face="monospace, monospace">tempF = 1.8 * tempC + 32. ; metadata is stripped</font></div><div style="font-size:small"><font face="monospace, monospace">copy_VarMeta(tempC,tempF) ; copies *all* metadata from tempC to tempF</font></div><div style="font-size:small"><font face="monospace, monospace">tempF@units = "degF" ; fix the units</font></div><div style="font-size:small"><br></div><div style="font-size:small">If you just want to copy the variable coordinate arrays, but not the variable attributes, then:</div><div style="font-size:small"><br></div><div style=""><div style=""><font face="monospace, monospace">tempF = 1.8 * tempC + 32. </font></div><div style=""><font face="monospace, monospace">copy_VarCoords(tempC,tempF) ; copies only the coordinate arrays (if any) from tempC to tempF</font></div><div style=""><font face="monospace, monospace"><br></font></div><div style=""><font face="monospace, monospace">;---You wil have to add all the attributes yourself</font></div><div style=""><font face="monospace, monospace">tempF@long_name = "temperature</font></div><div style=""><font face="monospace, monospace">tempF@units = "degF" ; still need to fix the units</font></div></div><div style="font-size:small"><br></div><div style="font-size:small">See:</div><div style="font-size:small"><br></div><div style=""><a href="http://www.ncl.ucar.edu/Document/Functions/Contributed/copy_VarMeta.shtml">http://www.ncl.ucar.edu/Document/Functions/Contributed/copy_VarMeta.shtml</a><br></div><div style=""><a href="http://www.ncl.ucar.edu/Document/Functions/Contributed/copy_VarCoords.shtml">http://www.ncl.ucar.edu/Document/Functions/Contributed/copy_VarCoords.shtml</a><br></div><div style=""><a href="http://www.ncl.ucar.edu/Document/Functions/Contributed/copy_VarAtts.shtml">http://www.ncl.ucar.edu/Document/Functions/Contributed/copy_VarAtts.shtml</a><br></div><div style=""><br></div><div style="">--Mary</div><div style=""><br></div></div></div>
</div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, May 18, 2016 at 7:09 PM, Herbster, Christopher G. <span dir="ltr"><<a href="mailto:herbstec@erau.edu" target="_blank">herbstec@erau.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 style="font-size:12pt;color:#000000;background-color:#ffffff;font-family:Calibri,Arial,Helvetica,sans-serif">
<p>Mary,</p>
<p><br>
</p>
<p>Thanks again for your help. First, I forgot to mention that the nomads server only holds two days of data. The date in the script had the value hardwired to a date that is no longer there. Just change it to "yesterday" and it should find data on the other
end.</p>
<p><br>
</p>
<p>Next, I was getting error/warnings about not having coordinates for a variable I was plotting. When I sent my message, I didn't really know where that was coming from. I now know that this was from the "speed" variable that I created from the U and V components
of the current. I got rid of this issue by what I would call a hammer technique. I first did</p>
<p>speed = u_velocity</p>
<p>and then </p>
<p><span>speed = sqrt((u_velocity^2)+(v_velocity^2)) * 1.9438 ; convert m/s to knots</span><br>
</p>
<p><span><br>
</span></p>
<p><span>This got rid of the error, and, I think, has also fixed any plotting issues there may have been with presenting the data on a map.</span></p>
<p><span><br>
</span></p>
<p><span>However, this hammer is more than I wanted, as now all of the attributes are set to the U component of the current. Is there a better way to do this? Should I do this and then change just what I need to change, or should I just create the code to
set all the metadata (attributes?) for the variable?</span></p>
<p><span><br>
</span></p>
<p><span>I'd like to start adopting a "best practice" method, as I hope to eventually have my students develop code in NCL for some of my class projects.</span></p>
<p><span><br>
</span></p>
<p><span>Thanks again for your help, and sorry for the cryptic questions. I'll try to do better. (Though I think I've gotten some insight on how to deal with my student's questions! (-:)</span></p>
<p><span><br>
</span></p>
<p><span>Cheers,</span></p>
<p><span><br>
</span></p>
<p><span>Chris H.</span></p><span class="">
<p><br>
</p>
<div>
<div style="font-size:12pt;color:#000000;background-color:#ffffff;font-family:Calibri,Arial,Helvetica,sans-serif">
<div><span style="font-size:12pt">Dr. Christopher G. Herbster</span></div>
<div><span style="font-size:12pt">Associate Professor</span></div>
<div><span style="font-size:12pt">Director of Science and Technology</span></div>
<div><span style="font-size:12pt">for the ERAU Weather Center</span></div>
<div><span style="font-size:12pt">Applied Aviation Sciences</span></div>
<div><span style="font-size:12pt">Embry-Riddle Aeronautical Univ.</span></div>
<div><span style="font-size:12pt">600 S. Clyde Morris Blvd.</span></div>
<div><span style="font-size:12pt">Daytona Beach, FL 32114-3900</span></div>
<div> </div>
<div><span style="font-size:12pt"><a href="tel:386.226.6444" value="+13862266444" target="_blank">386.226.6444</a> Office</span></div>
<div><span style="font-size:12pt"><a href="tel:386.226.6446" value="+13862266446" target="_blank">386.226.6446</a> Weather Center</span></div>
<div><span style="font-size:12pt"><a href="http://wx.erau.edu/" target="_blank">http://wx.erau.edu/</a></span></div>
<div><br style="font-size:12pt">
</div>
<div><span style="font-size:12pt">Schedule at: <a href="http://wx.erau.edu/faculty/herbster/Schedules/" target="_blank">http://wx.erau.edu/faculty/herbster/Schedules/</a><br>
</span></div>
<br>
</div>
</div>
<br>
<br>
</span><div style="color:rgb(0,0,0)">
<hr style="display:inline-block;width:98%">
<div dir="ltr"><font face="Calibri, sans-serif" color="#000000" style="font-size:11pt"><b>From:</b> Mary Haley <<a href="mailto:haley@ucar.edu" target="_blank">haley@ucar.edu</a>><br>
<b>Sent:</b> Wednesday, May 18, 2016 11:06 AM<br>
<b>To:</b> Herbster, Christopher G.<div><div class="h5"><br>
<b>Cc:</b> <a href="mailto:ncl-talk@ucar.edu" target="_blank">ncl-talk@ucar.edu</a><br>
<b>Subject:</b> Re: [ncl-talk] Problem reading data from NCEP DODS server</div></div></font>
<div> </div>
</div><div><div class="h5">
<div>
<div dir="ltr">
<div class="gmail_default" style="font-size:small">Chris,</div>
<div class="gmail_default" style="font-size:small"><br>
</div>
<div class="gmail_default" style="font-size:small">Yes, the "all(ismissing(sst))" is a way to trap this special case.</div>
<div class="gmail_default" style="font-size:small"><br>
</div>
<div class="gmail_default" style="font-size:small">I'm not sure what you are asking in your second question. When you subset "sst" with the given lat/lon range, then the lat/lon coordinate arrays should also be subsetted automatically.</div>
<div class="gmail_default" style="font-size:small"><br>
</div>
<div class="gmail_default" style="font-size:small">I just tried to run your script again to verify that you indeed have coordinate arrays attached to your data, but it appears the file is no longer there.</div>
<div class="gmail_default" style="font-size:small"><br>
</div>
<div class="gmail_default" style="font-size:small">You can verify this yourself by doing a "printVarSummary" on "sst" after you read it off a file.</div>
<div class="gmail_default" style="font-size:small"><br>
</div>
<div class="gmail_default" style="font-size:small">Here's a little sample script that you should be able to run as-is:</div>
<div class="gmail_default" style="font-size:small"><br>
</div>
<div class="gmail_default">
<div class="gmail_default"><font face="monospace, monospace"> a = addfile("$NCARG_ROOT/lib/ncarg/data/cdf/<a href="http://uv300.nc" target="_blank">uv300.nc</a>","r")</font></div>
<div class="gmail_default"><font face="monospace, monospace"> u = a->U(1,:,:)</font></div>
<div class="gmail_default"><font face="monospace, monospace"><br>
</font></div>
<div class="gmail_default"><font face="monospace, monospace"> printVarSummary(u)</font></div>
<div class="gmail_default"><font face="monospace, monospace"><br>
</font></div>
<div class="gmail_default"><font face="monospace, monospace"> u_subset = a->U(1,{0:30},{-10:10})</font></div>
<div class="gmail_default"><font face="monospace, monospace"> printVarSummary(u_subset)</font></div>
<div class="gmail_default"><br>
</div>
<div class="gmail_default">The output (trimmed) will look like this:</div>
<div class="gmail_default"><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">. . .</font></div>
<div class="gmail_default"><span style="font-family:monospace,monospace">Dimensions and sizes:</span><span style="font-family:monospace,monospace;white-space:pre-wrap">
</span><span style="font-family:monospace,monospace">[lat | 64] x [lon | 128]</span><br>
</div>
<div class="gmail_default"><font face="monospace, monospace">Coordinates: </font></div>
<div class="gmail_default"><font face="monospace, monospace"> lat: [-87.8638..87.8638]</font></div>
<div class="gmail_default"><font face="monospace, monospace"> lon: [-180..177.1875]</font></div>
<div class="gmail_default"><font face="monospace, monospace">Number Of Attributes: 5</font></div>
<div class="gmail_default"><font face="monospace, monospace"> time :<span style="white-space:pre-wrap">
</span>7</font></div>
<div class="gmail_default"><font face="monospace, monospace"> _FillValue :<span style="white-space:pre-wrap">
</span>-999</font></div>
<div class="gmail_default"><font face="monospace, monospace"> long_name :<span style="white-space:pre-wrap">
</span>Zonal Wind</font></div>
<div class="gmail_default"><font face="monospace, monospace"> short_name :<span style="white-space:pre-wrap">
</span>U</font></div>
<div class="gmail_default"><font face="monospace, monospace"> units :<span style="white-space:pre-wrap">
</span>m/s</font></div>
<div class="gmail_default"><font face="monospace, monospace"><br>
</font></div>
<div class="gmail_default"><font face="monospace, monospace">Variable: u_subset</font></div>
<div class="gmail_default"><font face="monospace, monospace">Type: float</font></div>
<div class="gmail_default"><font face="monospace, monospace">. . .</font></div>
<div class="gmail_default"><font face="monospace, monospace">Dimensions and sizes:<span style="white-space:pre-wrap">
</span>[lat | 11] x [lon | 7]</font></div>
<div class="gmail_default"><font face="monospace, monospace">Coordinates: </font></div>
<div class="gmail_default"><font face="monospace, monospace"> lat: [1.395307..29.30136]</font></div>
<div class="gmail_default"><font face="monospace, monospace"> lon: [-8.4375..8.4375]</font></div>
<div class="gmail_default"><font face="monospace, monospace">Number Of Attributes: 5</font></div>
<div class="gmail_default"><font face="monospace, monospace"> time :<span style="white-space:pre-wrap">
</span>7</font></div>
<div class="gmail_default"><font face="monospace, monospace"> _FillValue :<span style="white-space:pre-wrap">
</span>-999</font></div>
<div class="gmail_default"><font face="monospace, monospace"> long_name :<span style="white-space:pre-wrap">
</span>Zonal Wind</font></div>
<div class="gmail_default"><font face="monospace, monospace"> short_name :<span style="white-space:pre-wrap">
</span>U</font></div>
<div class="gmail_default"><font face="monospace, monospace"> units :<span style="white-space:pre-wrap">
</span>m/s</font></div>
<div class="gmail_default"><br>
</div>
</div>
</div>
<div class="gmail_default" style="font-size:small"><br>
</div>
<div class="gmail_default" style="font-size:small">Note that for "u_subset", the lat/lon coordinates have the new subsetted range, based on the closest *less than* values to the lat/lon range I gave it.</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 class="gmail_extra">
<div class="gmail_quote">On Tue, May 17, 2016 at 5:54 PM, Herbster, Christopher G.
<span dir="ltr"><<a href="mailto:herbstec@erau.edu" target="_blank">herbstec@erau.edu</a>></span> wrote:<br>
<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 lang="EN-US">
<div>
<p class="MsoNormal"><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)">Mary,<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)">Thanks for checking what seems obvious in hindsight. Feeling a bit sheepish.<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)">Can I trap this with an:<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)">if(all(ismissing(sst))) then
<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)"> … ; don’t do much<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)">else<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)">… ; make plots<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)">end if<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)">Boy have I wasted some time thinking this had to do with the longitude being 74 – 434 degrees east. I had originally thought that I was somehow only getting
data over land, where SST would certainly be missing.<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)">Also, is there a preferred way to have the meta data for the subset data have ranges that are indicative of the subset, rather than the whole domain?<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)">Thanks again for catching my oversight,<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)">Chris H.<u></u><u></u></span></p>
<span>
<p class="MsoNormal"><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)">--
<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)">Dr. Christopher G. Herbster<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)">Associate Professor<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)">Director of Science and Technology<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)">for the ERAU Weather Center<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)">Applied Aviation Sciences<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)">Embry-Riddle Aeronautical Univ.<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)">600 S. Clyde Morris Blvd.<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)">Daytona Beach, FL 32114-3900<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)"><u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)"> <a href="tel:386.226.6444" value="+13862266444" target="_blank">386.226.6444</a> Office<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)"><a href="tel:386.226.6446" value="+13862266446" target="_blank">386.226.6446</a> Weather Center<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)"><a href="http://wx.erau.edu/" target="_blank">http://wx.erau.edu/</a><u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)">Schedule at:
<a href="http://wx.erau.edu/faculty/herbster/Schedules/" target="_blank">http://wx.erau.edu/faculty/herbster/Schedules/</a><u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)"><u></u> <u></u></span></p>
</span>
<p class="MsoNormal"><b><span style="font-size:11pt;font-family:Calibri,sans-serif">From:</span></b><span style="font-size:11pt;font-family:Calibri,sans-serif"> Mary Haley [mailto:<a href="mailto:haley@ucar.edu" target="_blank">haley@ucar.edu</a>]
<br>
<b>Sent:</b> Tuesday, May 17, 2016 5:58 PM<br>
<b>To:</b> Herbster, Christopher G. <<a href="mailto:herbstec@erau.edu" target="_blank">herbstec@erau.edu</a>><br>
<b>Cc:</b> <a href="mailto:ncl-talk@ucar.edu" target="_blank">ncl-talk@ucar.edu</a><br>
<b>Subject:</b> Re: [ncl-talk] Problem reading data from NCEP DODS server<u></u><u></u></span></p>
<div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
<div>
<div>
<p class="MsoNormal">Chris,<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">I think the issue is simply that the first time step of "sst" is all missing. <u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">If you select a different time step, then it looks fine:<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<div>
<p class="MsoNormal"><span style="font-family:'Courier New'">; sst = f->sst(mytime,:,Slat:Nlat,Wlon:Elon) </span><u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><span style="font-family:'Courier New'"> </span><u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><span style="font-family:'Courier New'">sst = f->sst(:,:,Slat:Nlat,Wlon:Elon) ; NOTE: READING ALL TIME STEPS</span><u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><span style="font-family:'Courier New'">print("done reading sst")</span><u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><span style="font-family:'Courier New'">print("dimsizes sst = " + str_join(dimsizes(sst),","))</span><u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal"><span style="font-family:'Courier New'">do nt=0,dimsizes(sst(:,0,0,0))-1</span><u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><span style="font-family:'Courier New'"> printMinMax(sst(nt,:,:,:),0)</span><u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><span style="font-family:'Courier New'">end do</span><u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal"><span style="font-family:'Courier New'">This is the output:</span><u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<div>
<p class="MsoNormal"><span style="font-family:'Courier New'">(0) dimsizes sst = 65,1,265,481<u></u><u></u></span></p>
</div>
<div>
<div>
<p class="MsoNormal"><span style="font-family:'Courier New'">nt = 0<u></u><u></u></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-family:'Courier New'">sea_surface_temperature (c) : min=1.26765e+30 max=1.26765e+30<u></u><u></u></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-family:'Courier New'">nt = 1<u></u><u></u></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-family:'Courier New'">sea_surface_temperature (c) : min=21.6418 max=32.2542<u></u><u></u></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-family:'Courier New'">nt = 2<u></u><u></u></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-family:'Courier New'">sea_surface_temperature (c) : min=21.6017 max=32.3401<u></u><u></u></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-family:'Courier New'">nt = 3<u></u><u></u></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-family:'Courier New'">sea_surface_temperature (c) : min=21.5984 max=32.3429<u></u><u></u></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-family:'Courier New'">nt = 4<u></u><u></u></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-family:'Courier New'">sea_surface_temperature (c) : min=21.6628 max=32.1836<u></u><u></u></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-family:'Courier New'">nt = 5<u></u><u></u></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-family:'Courier New'">sea_surface_temperature (c) : min=22.0586 max=32.491<u></u><u></u></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-family:'Courier New'">nt = 6<u></u><u></u></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-family:'Courier New'">sea_surface_temperature (c) : min=22.2371 max=32.6994<u></u><u></u></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-family:'Courier New'"><u></u> <u></u></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-family:'Courier New'">--Mary<u></u><u></u></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-family:'Courier New'"><u></u> <u></u></span></p>
</div>
</div>
</div>
</div>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
<div>
<p class="MsoNormal">On Tue, May 17, 2016 at 10:28 AM, Herbster, Christopher G. <<a href="mailto:herbstec@erau.edu" target="_blank">herbstec@erau.edu</a>> wrote:<u></u><u></u></p>
<blockquote style="border-style:none none none solid;border-left-width:1pt;border-left-color:rgb(204,204,204);padding:0in 0in 0in 6pt;margin-left:4.8pt;margin-right:0in">
<div>
<div>
<p class="MsoNormal">Hi folks,<u></u><u></u></p>
<p class="MsoNormal"> <u></u><u></u></p>
<p class="MsoNormal">I’m trying to retrieve some data for a subset region from the Global Real Time Ocean Forecast System (RTOFS), and I can’t figure out why I get all missing values when I try to read the data.<u></u><u></u></p>
<p class="MsoNormal"> <u></u><u></u></p>
<p class="MsoNormal">This seems to be the case for me even if I try to read this whole domain.<u></u><u></u></p>
<p class="MsoNormal"> <u></u><u></u></p>
<p class="MsoNormal">Here is some code:<u></u><u></u></p>
<p class="MsoNormal">------<u></u><u></u></p>
<p class="MsoNormal">; read-rtofs-dods.ncl <u></u><u></u></p>
<p class="MsoNormal">load "$NCARG_ROOT/lib/ncarg/nclscripts/contrib/cd_string.ncl"<u></u><u></u></p>
<p class="MsoNormal">; <u></u><u></u></p>
<p class="MsoNormal"> <u></u><u></u></p>
<p class="MsoNormal">Dev = "png"<u></u><u></u></p>
<p class="MsoNormal"> <u></u><u></u></p>
<p class="MsoNormal">;<u></u><u></u></p>
<p class="MsoNormal">myDate = 20160516<u></u><u></u></p>
<p class="MsoNormal"> <u></u><u></u></p>
<p class="MsoNormal">;NOMADS = "<a href="http://nomads.ncep.noaa.gov:9090/dods/rtofs/rtofs_global" target="_blank">http://nomads.ncep.noaa.gov:9090/dods/rtofs/rtofs_global</a>"+myDate+"/rtofs_glo_2ds_forecast_daily_prog"<u></u><u></u></p>
<p class="MsoNormal"> <u></u><u></u></p>
<p class="MsoNormal">NOMADS = "<a href="http://nomads.ncep.noaa.gov:9090/dods/rtofs/rtofs_global" target="_blank">http://nomads.ncep.noaa.gov:9090/dods/rtofs/rtofs_global</a>"+myDate+"/rtofs_glo_2ds_forecast_3hrly_prog"<u></u><u></u></p>
<p class="MsoNormal"> <u></u><u></u></p>
<p class="MsoNormal">filename = NOMADS ; = url <u></u><u></u></p>
<p class="MsoNormal">print("Fetching URL: ")<u></u><u></u></p>
<p class="MsoNormal">print(" "+filename)<u></u><u></u></p>
<p class="MsoNormal"> <u></u><u></u></p>
<p class="MsoNormal"> exists = isfilepresent(filename)<u></u><u></u></p>
<p class="MsoNormal"> if(.not.exists) then <u></u><u></u></p>
<p class="MsoNormal"> print("OPeNDAP isfilepresent test unsuccessful.")<u></u><u></u></p>
<p class="MsoNormal"> print("Either file doesn't exist, or NCL does not have OPeNDAP capabilities on this system")<u></u><u></u></p>
<p class="MsoNormal"> exit<u></u><u></u></p>
<p class="MsoNormal"> else<u></u><u></u></p>
<p class="MsoNormal"> print("OPeNDAP isfilepresent test successful.")<u></u><u></u></p>
<p class="MsoNormal"> f = addfile(filename,"r")<u></u><u></u></p>
<p class="MsoNormal"> vars = getfilevarnames(f)<u></u><u></u></p>
<p class="MsoNormal"> print(vars) ; should be (in any order): <u></u><u></u></p>
<p class="MsoNormal"> <u></u><u></u></p>
<p class="MsoNormal"> if(.not.any(ismissing(vars))) then<u></u><u></u></p>
<p class="MsoNormal"> do i=0,dimsizes(vars)-1<u></u><u></u></p>
<p class="MsoNormal"> printFileVarSummary (f,vars(i))<u></u><u></u></p>
<p class="MsoNormal"> end do<u></u><u></u></p>
<p class="MsoNormal"> end if<u></u><u></u></p>
<p class="MsoNormal"> end if<u></u><u></u></p>
<p class="MsoNormal"> <u></u><u></u></p>
<p class="MsoNormal">; Define boundary of data<u></u><u></u></p>
<p class="MsoNormal">; Assign lat/lon boundaries to the data<u></u><u></u></p>
<p class="MsoNormal">; Longitudes between 0 and 74 E need to have 360 added to them<u></u><u></u></p>
<p class="MsoNormal">;<u></u><u></u></p>
<p class="MsoNormal">myNlat = 32.0<u></u><u></u></p>
<p class="MsoNormal">mySlat = 10.0<u></u><u></u></p>
<p class="MsoNormal">myWlon = 260.0<u></u><u></u></p>
<p class="MsoNormal">myElon = 300.0<u></u><u></u></p>
<p class="MsoNormal"> <u></u><u></u></p>
<p class="MsoNormal">;myNlat = 26.0<u></u><u></u></p>
<p class="MsoNormal">;mySlat = 21.0<u></u><u></u></p>
<p class="MsoNormal">;myWlon = 260.0<u></u><u></u></p>
<p class="MsoNormal">;myElon = 300.0<u></u><u></u></p>
<p class="MsoNormal"> <u></u><u></u></p>
<p class="MsoNormal">; Full domain <u></u><u></u></p>
<p class="MsoNormal">;myNlat = 90.0<u></u><u></u></p>
<p class="MsoNormal">;mySlat = -90.0<u></u><u></u></p>
<p class="MsoNormal">;myWlon = 74.0<u></u><u></u></p>
<p class="MsoNormal">;myElon = 434.0<u></u><u></u></p>
<p class="MsoNormal"> <u></u><u></u></p>
<p class="MsoNormal"> <u></u><u></u></p>
<p class="MsoNormal"> <u></u><u></u></p>
<p class="MsoNormal">; Get lat/lon/time info first<u></u><u></u></p>
<p class="MsoNormal">lat = f->lat<u></u><u></u></p>
<p class="MsoNormal">print ("Done reading lat")<u></u><u></u></p>
<p class="MsoNormal">lon = f->lon<u></u><u></u></p>
<p class="MsoNormal">print ("Done reading lon")<u></u><u></u></p>
<p class="MsoNormal">time = f->time(0)<u></u><u></u></p>
<p class="MsoNormal">print ("Done reading time")<u></u><u></u></p>
<p class="MsoNormal">;<u></u><u></u></p>
<p class="MsoNormal">; Use just one time when "0"<u></u><u></u></p>
<p class="MsoNormal">mytime = 0<u></u><u></u></p>
<p class="MsoNormal">;mytime = ":"<u></u><u></u></p>
<p class="MsoNormal"> <u></u><u></u></p>
<p class="MsoNormal">Nlat = closest_val(myNlat, lat)<u></u><u></u></p>
<p class="MsoNormal">print ("Nlat = " + Nlat + " Lat = " + lat(Nlat) )<u></u><u></u></p>
<p class="MsoNormal"> <u></u><u></u></p>
<p class="MsoNormal">Slat = closest_val(mySlat, lat)<u></u><u></u></p>
<p class="MsoNormal">print ("Slat = " + Slat + " Lat = " + lat(Slat) )<u></u><u></u></p>
<p class="MsoNormal"> <u></u><u></u></p>
<p class="MsoNormal">Wlon = closest_val(myWlon, lon)<u></u><u></u></p>
<p class="MsoNormal">print("Wlon = " + Wlon + " Lon = " + lon(Wlon) )<u></u><u></u></p>
<p class="MsoNormal"> <u></u><u></u></p>
<p class="MsoNormal">Elon = closest_val(myElon, lon)<u></u><u></u></p>
<p class="MsoNormal">print("Elon = " + Elon + " Lon = " + lon(Elon) )<u></u><u></u></p>
<p class="MsoNormal">;<u></u><u></u></p>
<p class="MsoNormal">;exit<u></u><u></u></p>
<p class="MsoNormal">;<u></u><u></u></p>
<p class="MsoNormal">mylat = lat(Slat:Nlat)<u></u><u></u></p>
<p class="MsoNormal">mylon = lon(Wlon:Elon)<u></u><u></u></p>
<p class="MsoNormal"> <u></u><u></u></p>
<p class="MsoNormal">printVarSummary (mylat)<u></u><u></u></p>
<p class="MsoNormal">printVarSummary (mylon)<u></u><u></u></p>
<p class="MsoNormal"> <u></u><u></u></p>
<p class="MsoNormal">print (mylat)<u></u><u></u></p>
<p class="MsoNormal"> <u></u><u></u></p>
<p class="MsoNormal">;exit<u></u><u></u></p>
<p class="MsoNormal"> <u></u><u></u></p>
<p class="MsoNormal"> <u></u><u></u></p>
<p class="MsoNormal">delete(lat)<u></u><u></u></p>
<p class="MsoNormal">delete(lon)<u></u><u></u></p>
<p class="MsoNormal"> <u></u><u></u></p>
<p class="MsoNormal">lat = f->lat(Slat:Nlat)<u></u><u></u></p>
<p class="MsoNormal">lon = f->lon(Wlon:Elon)<u></u><u></u></p>
<p class="MsoNormal">print ("Done reading subset lat/lon")<u></u><u></u></p>
<p class="MsoNormal"> <u></u><u></u></p>
<p class="MsoNormal">printVarSummary(lat)<u></u><u></u></p>
<p class="MsoNormal">print (lat)<u></u><u></u></p>
<p class="MsoNormal"> <u></u><u></u></p>
<p class="MsoNormal">printVarSummary(lon)<u></u><u></u></p>
<p class="MsoNormal">print (lon)<u></u><u></u></p>
<p class="MsoNormal"> <u></u><u></u></p>
<p class="MsoNormal">;exit<u></u><u></u></p>
<p class="MsoNormal"> <u></u><u></u></p>
<p class="MsoNormal"> <u></u><u></u></p>
<p class="MsoNormal">sst = f->sst(mytime,:,Slat:Nlat,Wlon:Elon)<u></u><u></u></p>
<p class="MsoNormal">;sst = f->sst<u></u><u></u></p>
<p class="MsoNormal">print ("Done reading sst")<u></u><u></u></p>
<p class="MsoNormal">printVarSummary(sst)<u></u><u></u></p>
<p class="MsoNormal">print (sst)<u></u><u></u></p>
<p class="MsoNormal"> <u></u><u></u></p>
<p class="MsoNormal">; exit ; Uncomment to stop after sst data are read <u></u><u></u></p>
<p class="MsoNormal"> <u></u><u></u></p>
<p class="MsoNormal">u_velocity = f->u_velocity(mytime,:,Slat:Nlat,Wlon:Elon)<u></u><u></u></p>
<p class="MsoNormal">;u_velocity = f->u_velocity<u></u><u></u></p>
<p class="MsoNormal">print ("Done reading U")<u></u><u></u></p>
<p class="MsoNormal">printVarSummary(u_velocity)<u></u><u></u></p>
<p class="MsoNormal">print (u_velocity)<u></u><u></u></p>
<p class="MsoNormal">v_velocity = f->v_velocity(mytime,:,Slat:Nlat,Wlon:Elon)<u></u><u></u></p>
<p class="MsoNormal">;v_velocity = f->v_velocity<u></u><u></u></p>
<p class="MsoNormal">print ("Done reading V")<u></u><u></u></p>
<p class="MsoNormal">printVarSummary(v_velocity)<u></u><u></u></p>
<p class="MsoNormal">print (v_velocity)<u></u><u></u></p>
<p class="MsoNormal">speed = sqrt((u_velocity*u_velocity) + (v_velocity*v_velocity))<u></u><u></u></p>
<p class="MsoNormal">print ("Done calculating Speed")<u></u><u></u></p>
<p class="MsoNormal">print (speed)<u></u><u></u></p>
<p class="MsoNormal"> <u></u><u></u></p>
<p class="MsoNormal"> <u></u><u></u></p>
<p class="MsoNormal">exit<u></u><u></u></p>
<p class="MsoNormal">;;;;;;<u></u><u></u></p>
<p class="MsoNormal">;;;;;; END of code snippet<u></u><u></u></p>
<p class="MsoNormal"> <u></u><u></u></p>
<p class="MsoNormal">------<u></u><u></u></p>
<p class="MsoNormal"> <u></u><u></u></p>
<p class="MsoNormal">If you run this code, I suggest a redirect into a file, as there are a lot of lines written to standard out.<u></u><u></u></p>
<p class="MsoNormal"> <u></u><u></u></p>
<p class="MsoNormal">What I don’t understand is that I can read a subset of the lat and lon data, but when I try to get any other data they all come up as missing/fill values.<u></u><u></u></p>
<p class="MsoNormal"> <u></u><u></u></p>
<p class="MsoNormal">Any help is GREATLY appreciated and I have really chased my tail trying to get past this.<u></u><u></u></p>
<p class="MsoNormal"> <u></u><u></u></p>
<p class="MsoNormal">Thanks,<u></u><u></u></p>
<p class="MsoNormal">Chris Herbster<u></u><u></u></p>
<p class="MsoNormal">-- <u></u><u></u></p>
<p class="MsoNormal"> <u></u><u></u></p>
<p class="MsoNormal">Dr. Christopher G. Herbster<u></u><u></u></p>
<p class="MsoNormal">Associate Professor<u></u><u></u></p>
<p class="MsoNormal">Director of Science and Technology<u></u><u></u></p>
<p class="MsoNormal">for the ERAU Weather Center<u></u><u></u></p>
<p class="MsoNormal">Applied Aviation Sciences<u></u><u></u></p>
<p class="MsoNormal">Embry-Riddle Aeronautical Univ.<u></u><u></u></p>
<p class="MsoNormal">600 S. Clyde Morris Blvd.<u></u><u></u></p>
<p class="MsoNormal">Daytona Beach, FL 32114-3900<u></u><u></u></p>
<p class="MsoNormal"> <a href="tel:386.226.6444" target="_blank">386.226.6444</a> Office<u></u><u></u></p>
<p class="MsoNormal"><a href="tel:386.226.6446" target="_blank">386.226.6446</a> Weather Center<u></u><u></u></p>
<p class="MsoNormal"><a href="http://wx.erau.edu/" target="_blank">http://wx.erau.edu/</a><u></u><u></u></p>
<p class="MsoNormal"> <u></u><u></u></p>
<p class="MsoNormal">Schedule at: <a href="http://wx.erau.edu/faculty/herbster/Schedules/" target="_blank">
http://wx.erau.edu/faculty/herbster/Schedules/</a><u></u><u></u></p>
<p class="MsoNormal"> <u></u><u></u></p>
</div>
</div>
<p class="MsoNormal" style="margin-bottom:12pt"><br>
_______________________________________________<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" target="_blank">http://mailman.ucar.edu/mailman/listinfo/ncl-talk</a><u></u><u></u></p>
</blockquote>
</div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
</div>
</div>
</div>
</div>
</blockquote>
</div>
<br>
</div>
</div>
</div>
</div></div></div>
</div>
</div>
</blockquote></div><br></div>