<div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div><br></div><div>[0] General comment: The primary variable is:<br></div><div><br></div><div>        float t(<b><span style="color:rgb(0,0,255)">time</span>,</b> z, y, x) ;<br>                t:long_name = "potential temperature" ;<br>                t:units = "K" ;<br>                t:coordinates = "east_e north_e  zz" ;</div><div><br></div><div>Here <b><span style="color:rgb(0,0,255)">time</span> </b>is the <b>record dimension</b>. <br></div><div><br></div><div>The <a href="http://www.ncl.ucar.edu/Document/Functions/Built-in/addfiles.shtml" target="_blank"><span style="color:rgb(0,0,255)"><b>addfiles</b></span></a>  function <span style="color:rgb(204,0,0)">concatenates </span>[ <span style="color:rgb(204,0,0)">aggregates</span> ] along the <b>record dimension [ <b><span style="color:rgb(0,0,255)">time ]</span></b></b></div><div><b><b><span style="color:rgb(0,0,255)"><br></span></b></b></div><div><span style="color:rgb(0,0,0)">--</span></div><div><b><b><span style="color:rgb(0,0,255)"><br></span></b></b></div><div>[1] The 'time' variable <span style="color:rgb(0,0,255)"><b>is</b></span> <span style="color:rgb(0,0,255)"><b>monotonic.</b></span></div><div><span style="color:rgb(0,0,255)"><b><br></b></span></div><div>There is nothing wrong with what you did. However, my *personal preference* would be to <br></div><div><br></div><div>Replace:<br></div><div><br></div><div>  temp  = a[:]->t <br>  Time  = a[:]->time</div><div><br></div><div>With</div><div><br></div><div><div>  temp   = a[:]->t <br>  time    = temp<b>&</b>time    ; extract the 'time' associated with the variable to be used<br></div><div><br></div><div>FYI: The <a href="http://www.ncl.ucar.edu/Document/Functions/Contributed/isMonotonic.shtml"><b>isMonotonic</b></a> function can test a variable <br></div><div><br></div><div>    mono =<b> isMonotonic</b>(time)   ; -1 (monotonic decreasing), 0 (not monotonic, +1 (monotonic increasing)</div><div>or</div><div>    mono =<b> isMonotonic</b>(t<b>&</b>time)  <br></div><div><br></div><div>Your time variable would be +1<br></div><div>----------------<br></div></div><div><br></div><div>[2] Error message: </div><div><b>warning: Aggregated dimension coordinate values are non-monotonic; check
 aggregated file ordering.</b></div><div><b><br></b></div><div>The variables<b> east_e </b>and <b>north_e </b>do *NOT* have a  record dimension (<span style="color:rgb(0,0,255)"><b>time</b></span>)  <br><b></b></div><div><b><br></b></div><div>       float east_e(y, x) ;<br>                east_e:long_name = "easting of elevation points" ;<br>                east_e:units = "metre" ;<br>                east_e:coordinates = "east_e north_e" ;<br>        float north_e(y, x) ;<br>                north_e:long_name = "northing of elevation points" ;<br>                north_e:units = "metre" ;<br>                north_e:coordinates = "east_e north_e" ;</div><div><br></div><div>Using the <span style="color:rgb(106,168,79)"><b>[:] </b>s<span style="color:rgb(0,0,0)">yntax causes <b>addfiles</b> to use the 'y' dimension as the record dimension. This is neither monotonic nor a record dimension.</span></span><br></div><div><b></b></div><div><b><br></b></div><div>Replace:</div><div><b><br></b></div><div> lon2d  = a[:]->east_e    ; <==== <b> [:]</b> <br> lat2d   = a[:]->north_e</div><div><br></div><div>I do not like using the 'lat2d' & 'lon2d' names. These are (currently) not Latitude and Longitude.</div><div>With (say) <br></div><div><br></div><div><div> e2d  = a[0]->east_e    ; <====  <b>[0]</b> , Read from 1st file only. No aggregation<br> n2d  = a[0]->north_e<br><div><div>----------------<br></div></div><div><br></div><div>[3] metre ==> latitude/longitude</div><div><br></div><div>I am not sure it can be done with the information on the file.</div><div>I have no expertise with converting 'northing'/'easting' meters to latitude and longitude.</div><div><br></div><div>I <span style="color:rgb(255,0,255)"><b>speculate</b></span> these are based upon the  <a href="https://en.wikipedia.org/wiki/Universal_Transverse_Mercator_coordinate_system" target="_blank"><b>Universal Transverse Mercator</b> (<b>UTM</b>) </a>conformal projection which uses a 2-dimensional Cartesian coordinate system to give locations on the surface of the Earth.</div><div><br></div><div>Again, I have no expertise, but in my opinion, the additional information needed may be a <b>utm_zone(y,x) </b>variable<b> </b>and a descriptor (attribute)<b> </b>specifying the base [DATUM]  being used<b>: </b>??? WGS_84_DATUM ???<br></div><div><br></div><div>Then, NCL's <a href="http://www.ncl.ucar.edu/Document/Functions/Built-in/utm2latlon.shtml" target="_blank"><b>utm2latlon</b></a> could likely be used. The interface to this function could be improved but it can be made to work.</div><div><br></div><div>----</div><div>[4]</div><div><br></div><div>The <b>temp </b>variable uses <b>0</b> to indicate land. Really, this is a very poor choice. Land should be set to some _FillValue. That way,</div><div>it will be ignored in any computations.</div><div><br></div><div>---</div><div>[5] Use <b>printVarSummary</b> and <b>printMinMax</b> to keep track of the data. It is *YOUR RESPONSIBILITY* to 'know your data'. Not ncl-talk!<br></div><div><br></div><div>---</div><div>[6]</div><div>That attached script plots the variable using index values. You can recognize the Indian Ocean and aurrounding land masses.</div><div><br></div><div>%> ncl jyothi.ncl</div><div><br></div><div>Good Luck<br></div></div></div></div></div></div></div></div><br><div class="gmail_quote"><div dir="ltr">On Thu, Nov 1, 2018 at 10:55 AM Jyothi L <<a href="mailto:jyothir033@gmail.com" target="_blank">jyothir033@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div>Thanks for the response. The output for the script is as follows: <br></div><div dir="ltr"><br></div><div dir="ltr">Variable: time (file variable)<br>Type: float<br>Total Size: 4 bytes<br>            1 values<br>Number of Dimensions: 1<br>Dimensions and sizes:    [time | 1]<br>Coordinates: <br>            time: [ 0.. 0]<br>Number Of Attributes: 2<br>  long_name :    time<br>  units :    days since 2017-12-01 00:00:00 +00:00<br>(0)     0<br><br><br>Variable: time (file variable)<br>Type: float<br>Total Size: 4 bytes<br>            1 values<br>Number of Dimensions: 1<br>Dimensions and sizes:    [time | 1]<br>Coordinates: <br>            time: [0.25..0.25]<br>Number Of Attributes: 2<br>  long_name :    time<br>  units :    days since 2017-12-01 00:00:00 +00:00<br>(0)    0.25<br><br>Variable: time (file variable)<br>Type: float<br>Total Size: 4 bytes<br>            1 values<br>Number of Dimensions: 1<br>Dimensions and sizes:    [time | 1]<br>Coordinates: <br>            time: [0.5..0.5]<br>Number Of Attributes: 2<br>  long_name :    time<br>  units :    days since 2017-12-01 00:00:00 +00:00<br>(0)    0.5<br><br><br>Variable: time (file variable)<br>Type: float<br>Total Size: 4 bytes<br>            1 values<br>Number of Dimensions: 1<br>Dimensions and sizes:    [time | 1]<br>Coordinates: <br>            time: [0.75..0.75]<br>Number Of Attributes: 2<br>  long_name :    time<br>  units :    days since 2017-12-01 00:00:00 +00:00<br>(0)    0.75<br><br><br>Variable: time (file variable)<br>Type: float<br>Total Size: 4 bytes<br>            1 values<br>Number of Dimensions: 1<br>Dimensions and sizes:    [time | 1]<br>Coordinates: <br>            time: [ 1.. 1]<br>Number Of Attributes: 2<br>  long_name :    time<br>  units :    days since 2017-12-01 00:00:00 +00:00<br>(0)     1<br></div><div dir="ltr">Variable: time (file variable)<br>Type: float<br>Total Size: 4 bytes<br>            1 values<br>Number of Dimensions: 1<br>Dimensions and sizes:    [time | 1]<br>Coordinates: <br>            time: [1.25..1.25]<br>Number Of Attributes: 2<br>  long_name :    time<br>  units :    days since 2017-12-01 00:00:00 +00:00<br>(0)    1.25<br><br><br>Variable: time (file variable)<br>Type: float<br>Total Size: 4 bytes<br>            1 values<br>Number of Dimensions: 1<br>Dimensions and sizes:    [time | 1]<br>Coordinates: <br>            time: [1.5..1.5]<br>Number Of Attributes: 2<br>  long_name :    time<br>  units :    days since 2017-12-01 00:00:00 +00:00<br>(0)    1.5<br><br>Variable: time (file variable)<br>Type: float<br>Total Size: 4 bytes<br>            1 values<br>Number of Dimensions: 1<br>Dimensions and sizes:    [time | 1]<br>Coordinates: <br>            time: [1.75..1.75]<br>Number Of Attributes: 2<br>  long_name :    time<br>  units :    days since 2017-12-01 00:00:00 +00:00<br>(0)    1.75<br><br><br>Variable: time (file variable)<br>Type: float<br>Total Size: 4 bytes<br>            1 values<br>Number of Dimensions: 1<br>Dimensions and sizes:    [time | 1]<br>Coordinates: <br>            time: [ 2.. 2]<br>Number Of Attributes: 2<br>  long_name :    time<br>  units :    days since 2017-12-01 00:00:00 +00:00<br>(0)     2<br><br><br>Variable: time (file variable)<br>Type: float<br>Total Size: 4 bytes<br>            1 values<br>Number of Dimensions: 1<br>Dimensions and sizes:    [time | 1]<br>Coordinates: <br>            time: [2.25..2.25]<br>Number Of Attributes: 2<br>  long_name :    time<br>  units :    days since 2017-12-01 00:00:00 +00:00<br>(0)    2.25<br><br><br>Variable: time (file variable)<br>Type: float<br>Total Size: 4 bytes<br>            1 values<br>Number of Dimensions: 1<br>Dimensions and sizes:    [time | 1]<br>Coordinates: <br>            time: [2.5..2.5]<br>Number Of Attributes: 2<br>  long_name :    time<br>  units :    days since 2017-12-01 00:00:00 +00:00<br>(0)    2.5</div><div dir="ltr"><br></div><div dir="ltr">Variable: time (file variable)<br>Type: float<br>Total Size: 4 bytes<br>            1 values<br>Number of Dimensions: 1<br>Dimensions and sizes:    [time | 1]<br>Coordinates: <br>            time: [2.75..2.75]<br>Number Of Attributes: 2<br>  long_name :    time<br>  units :    days since 2017-12-01 00:00:00 +00:00<br>(0)    2.75<br><br>Variable: time (file variable)<br>Type: float<br>Total Size: 4 bytes<br>            1 values<br>Number of Dimensions: 1<br>Dimensions and sizes:    [time | 1]<br>Coordinates: <br>            time: [ 3.. 3]<br>Number Of Attributes: 2<br>  long_name :    time<br>  units :    days since 2017-12-01 00:00:00 +00:00<br>(0)     3<br><br><br>Variable: time (file variable)<br>Type: float<br>Total Size: 4 bytes<br>            1 values<br>Number of Dimensions: 1<br>Dimensions and sizes:    [time | 1]<br>Coordinates: <br>            time: [3.25..3.25]<br>Number Of Attributes: 2<br>  long_name :    time<br>  units :    days since 2017-12-01 00:00:00 +00:00<br>(0)    3.25<br><br><br>Variable: time (file variable)<br>Type: float<br>Total Size: 4 bytes<br>            1 values<br>Number of Dimensions: 1<br>Dimensions and sizes:    [time | 1]<br>Coordinates: <br>            time: [3.5..3.5]<br>Number Of Attributes: 2<br>  long_name :    time<br>  units :    days since 2017-12-01 00:00:00 +00:00<br>(0)    3.5<br><br>Variable: time (file variable)<br>Type: float<br>Total Size: 4 bytes<br>            1 values<br>Number of Dimensions: 1<br>Dimensions and sizes:    [time | 1]<br>Coordinates: <br>            time: [3.75..3.75]<br>Number Of Attributes: 2<br>  long_name :    time<br>  units :    days since 2017-12-01 00:00:00 +00:00<br>(0)    3.75<br><br><br>Variable: time (file variable)<br>Type: float<br>Total Size: 4 bytes<br>            1 values<br>Number of Dimensions: 1<br>Dimensions and sizes:    [time | 1]<br>Coordinates: <br>            time: [ 4.. 4]<br>Number Of Attributes: 2<br>  long_name :    time<br>  units :    days since 2017-12-01 00:00:00 +00:00<br>(0)     4<br><br><br>Variable: time (file variable)<br>Type: float<br>Total Size: 4 bytes<br>            1 values<br>Number of Dimensions: 1<br>Dimensions and sizes:    [time | 1]<br>Coordinates: <br>            time: [4.25..4.25]<br>Number Of Attributes: 2<br>  long_name :    time<br>  units :    days since 2017-12-01 00:00:00 +00:00<br>(0)    4.25<br></div><div dir="ltr">Variable: time (file variable)<br>Type: float<br>Total Size: 4 bytes<br>            1 values<br>Number of Dimensions: 1<br>Dimensions and sizes:    [time | 1]<br>Coordinates: <br>            time: [4.5..4.5]<br>Number Of Attributes: 2<br>  long_name :    time<br>  units :    days since 2017-12-01 00:00:00 +00:00<br>(0)    4.5<br><br><br>Variable: time (file variable)<br>Type: float<br>Total Size: 4 bytes<br>            1 values<br>Number of Dimensions: 1<br>Dimensions and sizes:    [time | 1]<br>Coordinates: <br>            time: [4.75..4.75]<br>Number Of Attributes: 2<br>  long_name :    time<br>  units :    days since 2017-12-01 00:00:00 +00:00<br>(0)    4.75<br><br><br>Variable: time (file variable)<br>Type: float<br>Total Size: 4 bytes<br>            1 values<br>Number of Dimensions: 1<br>Dimensions and sizes:    [time | 1]<br>Coordinates: <br>            time: [ 5.. 5]<br>Number Of Attributes: 2<br>  long_name :    time<br>  units :    days since 2017-12-01 00:00:00 +00:00<br>(0)     5<br><br></div></div></div></div></div></div></div></div><br><div class="gmail_quote"><div dir="ltr">On Thu, Nov 1, 2018 at 9:01 PM Mary Haley <<a href="mailto:haley@ucar.edu" target="_blank">haley@ucar.edu</a>> wrote:<br></div><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">Jyothi,</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">Thanks for providing the one file. We would need to see information about the other files, however, in order to determine why NCL couldn't aggregate the time dimension. We need to see what the time variable looks like across all the files.</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">It may be the case that time is monotonic on one file, but when you concatenate time across several files, it may not be monotonic depending on the "units" of each time variable and the values. If the units are different for each file, then this is going to be an issue, because NCL assumes that the aggregated dimension has the same units across all files.</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">Can you run this small script for me and email the output back to ncl-talk:</div><div class="gmail_default" style="font-size:small"><br></div><font face="monospace, monospace">dir = "/incois_ncmrwfx/incois/hycom/hwrf_output/pytmp/POMcoupled_emcPHY/com/2017120100/03B/"<br>files  = systemfunc("ls " + dir + "ockhi03b.2017120100.pom.00*.nc")<br><br>do nf=0,dimsizes(files)-1<br>  a = addfile(files(nf),"r")<br>  print(a->time)<br>end do</font><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">Hopefully I don't have any typos in the code.</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">Thanks,</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_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small"><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Oct 31, 2018 at 8:55 PM, Jyothi L <span dir="ltr"><<a href="mailto:jyothir033@gmail.com" target="_blank">jyothir033@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"><div>Hi,</div><div><br></div><div>I am trying to analyze 
the output from a list of forecast files simulated by Ocean Model. 
However, I have few issues regarding this output data. <br></div><div><br></div><div>1) <u>Regarding Time: </u><br></div><div>I
 used "cat" to combine the list of 21 forecast files. My idea behind 
merging is to make a time vs depth section. NCl shows the following 
error. Should I go with join instead of cat??<br></div><div><u><b>ERROR</b></u><br></div><div><b>    
 warning:Aggregated dimension coordinate values are non-monotonic; check
 aggregated file ordering.</b></div><div><b> </b>(Is it something to do with my Time values?)<b><br></b></div><div><br></div><div>printVarSummary(Time)    <br></div><div>Variable: Time<br>Type: float<br>Total Size: 84 bytes<br>            21 values<br>Number of Dimensions: 1<br>Dimensions and sizes:    [time | 21]<br>Coordinates: <br>            time: [ 0.. 5]<br>Number Of Attributes: 2<br>  long_name :    time<br>  units :    days since 2017-12-01 00:00:00 +00:00<br>(0)     0<br>(1)    0.25<br>(2)    0.5<br>(3)    0.75<br>(4)     1<br>(5)    1.25<br>(6)    1.5<br>(7)    1.75<br>(8)     2<br>(9)    2.25<br>(10)    2.5<br>(11)    2.75<br>(12)     3<br>(13)    3.25<br>(14)    3.5<br>(15)    3.75<br>(16)     4<br>(17)    4.25<br>(18)    4.5<br>(19)    4.75<br>(20)     5<br></div><div>How do I get the regular time axis from the above values?<br></div><div><br></div><div>2) <u>Regarding lat and lon :</u><br></div><div>
 I found the units of lat and lon are in meters. I want to convert them 
into degrees. I could get the conversion from radians to degrees and 
vice versa, but not meters to degrees. And also, this data is in 
curvilinear grid I suppose. <br></div><div><br></div><div>2) <u>Regarding depth:</u></div><div>Model
 output is in sigma coordinate system, where I would like to convert it 
into regular depth levels(meters). I found couple of examples in this 
regard which didn't help me much. <div class="gmail_chip gmail_drive_chip" style="width:396px;height:18px;max-height:18px;background-color:rgb(245,245,245);padding:5px;color:rgb(34,34,34);font-family:arial;font-style:normal;font-weight:bold;font-size:13px;border:1px solid rgb(221,221,221);line-height:1"><a href="https://drive.google.com/file/d/17Dc8CpN0gtgGFUX5H_iYhpgmQnnDpZYX/view?usp=drive_web" style="display:inline-block;max-width:366px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;text-decoration:none;padding:1px 0;border:none" target="_blank"><img style="vertical-align:bottom;border:none" src="https://ssl.gstatic.com/docs/doclist/images/icon_10_generic_list.png"> <span dir="ltr" style="color:rgb(17,85,204);text-decoration:none;vertical-align:bottom">ockhi03b.2017120100.pom.0000.nc</span></a><img style="opacity:0.55;float:right;display:none"></div></div><div><br></div><div>********************************<br></div><div>Below is a sample script where I tried to plot a 2D temperature plot at first time step over surface. (to check the data)  <br></div><div><br></div><div>dir    = "/incois_ncmrwfx/incois/hycom/hwrf_output/pytmp/POMcoupled_emcPHY/com/2017120100/03B/"<br>files  = systemfunc("ls " + dir + "ockhi03b.2017120100.pom.00*.nc")<br>a      = addfiles(files,"r")<br>ListSetType(a,"cat")<br>vNames = getfilevarnames(a[0])<br>print(vNames)<br><br>;----- Read character variable Times<br> </div><div> temp                = a[:]->t <br> Time                = a[:]->time<br> dep                 = a[:]->z<br> lon2d          = a[:]->east_e<br> lat2d          = a[:]->north_e<br>;;temp@lon2d = a[:]->east_e  ;;creating errors when I use <br></div><div>;;temp@lat2d  = a[:]->north_e ;;ditto<br></div><div>printVarSummary(lon2d)<br>printVarSummary(lat2d)<br><br>wks = gsn_open_wks("png","testOceanOutput")<br>res            = True <br>res@cnFillOn   = True <br>res@cnLinesOn  = False<br><br>plot = gsn_csm_contour(wks,temp(0,0,:,:),res)</div><div><br></div><div>This script makes a plot, which is INCORRECT. I have uploaded the data file using ftp. Kindly look into my data and give your suggestions. <br></div><div><br></div><div>Thanks in advance for your time and support.</div><div><br></div><div>Regards</div><span class="m_-915208315398366333m_2978854460415789506m_-1289385272340291089m_-3173995561303686230HOEnZb"><font color="#888888"><div>Jyothi<br></div></font></span></div>
<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" rel="noreferrer" target="_blank">http://mailman.ucar.edu/mailman/listinfo/ncl-talk</a><br>
<br></blockquote></div><br></div>
</blockquote></div>
_______________________________________________<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/mailman/listinfo/ncl-talk</a><br>
</blockquote></div>