<div dir="ltr">my bad! Thanks Dennis<br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sun, Apr 11, 2021 at 10:22 PM Dennis Shea <<a href="mailto:shea@ucar.edu">shea@ucar.edu</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div><span style="font-family:monospace">@ is for attributes</span></div><div><span style="font-family:monospace">& is for coordinates<br></span></div><div><span style="font-family:monospace"><br></span></div><div><span style="font-family:monospace">tprec@lat=lat</span></div><div><span style="font-family:monospace"></span></div><div><span style="font-family:monospace">tprec@lon=lon</span></div><div><span style="font-family:monospace"><br></span></div><div><span style="font-family:monospace">should be</span></div><div><span style="font-family:monospace"><br></span></div><div><span style="font-family:monospace"><span style="font-family:monospace">tprec&lat=lat<br>tprec&lon=lon</span></span></div><div><span style="font-family:monospace"><br></span></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sun, Apr 11, 2021 at 2:28 PM Jayant via ncl-talk <<a href="mailto:ncl-talk@mailman.ucar.edu" target="_blank">ncl-talk@mailman.ucar.edu</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>Hi Adam,</div><div>I am reading time-lat-lon data from a binary file. Next, I create coordinate variables based on the accompanying CTL file. The CTL file indicates the binary to be sequential. I assign the coordinates to a variable. But, I am getting an error. Below is a working example:</div><div><br></div><div style="margin-left:40px"><span style="font-family:monospace"> nlat=192<br> nlon=384<br> ntim=24<br> ;<br> lon = lonGlobeF(nlon, "lon", "longitude", "degrees_east")<br> lat = latGau(nlat, "lat", "latitude", "degrees_north")<br> ;<br> tim=new(ntim,integer)<br> tim!0         = "time"<br> tim@long_name = "time"<br> tim@units     = "hours"<br> tim&time      = tim<br> tim=0<br> ;<br> tprec=new((/ntim,nlat,nlon/),float)    ; surface variable<br> tprec!0="time"<br> tprec!1="lat"<br> tprec!2="lon"<br> tprec@time=tim<br> tprec@lat=lat<br> tprec@lon=lon<br> tprec@long_name="total precipitation"<br> tprec@units="kg m**-2 day**-1"<br> tprec=0.0<br> tprec=lonFlip(tprec)</span><br></div><div style="margin-left:40px"><span style="font-family:monospace">;--- executing the above<br></span></div><div style="margin-left:40px"><span style="font-family:monospace">ncl 29>  print(tprec(16,{-5.0:-3.0},{-90:-85}))<br><span style="color:rgb(255,0,0)">fatal:Dimension (lon) of (tprec) does not have an associated coordinate variable<br>fatal:["Execute.c":7741]:Execute: Error occurred at or near line 29</span><br>;<br>ncl 30>  print(tprec(16,{-5.0:-3.0},:))         <br><span style="color:rgb(255,0,0)">fatal:Dimension (lat) of (tprec) does not have an associated coordinate variable<br>fatal:["Execute.c":7741]:Execute: Error occurred at or near line 30</span></span></div><div style="margin-left:40px"><span style="font-family:monospace">;<br></span></div><div style="margin-left:40px"><span style="font-family:monospace">ncl 31> printVarSummary(tprec)<br>Variable: tprec<br>Type: float<br>Total Size: 7077888 bytes<br>            1769472 values<br>Number of Dimensions: 3<br>Dimensions and sizes:       [time | 24] x [lat | 192] x [lon | 384]<br>Coordinates: <br>Number Of Attributes: 7<br>  lonFlip :   longitude coordinate variable has been reordered via lonFlip<br>  time : <ARRAY of 24 elements><br>  lat :  <ARRAY of 192 elements><br>  lon : <ARRAY of 384 elements><br>  long_name :   total precipitation<br>  units : kg m**-2 day**-1<br>  _FillValue :       9.96921e+36</span></div><div><span style="font-family:monospace"><br></span></div><div style="margin-left:40px"><span style="font-family:monospace">ncl 32> print(isdimnamed(prec,ispan(0,2,1)))</span></div><div style="margin-left:40px"><span style="color:rgb(0,0,255)"><span style="font-family:monospace">    True</span></span></div><div style="margin-left:40px"><span style="color:rgb(0,0,255)"><span style="font-family:monospace">    True</span></span></div><div style="margin-left:40px"><span style="color:rgb(0,0,255)"><span style="font-family:monospace">    True</span></span></div><div style="margin-left:40px"><span style="font-family:monospace">;<br></span></div><div style="margin-left:40px"><span style="font-family:monospace">ncl 33>  if(all(iscoord(tprec,(/"time","lat","lon"/)))) then<br>    print("min/max tprec&lat = " + min(tprec&lat) + "/" + max(tprec&lat))<br>    print("min/max tprec&lon = " + min(tprec&lon) + "/" + max(tprec&lon))<br>         end if</span></div><div style="margin-left:40px"><span style="font-family:monospace">ncl 34> </span><br></div><div><br></div><div>What am I missing?<br></div><div><br></div><div>Also, the warnings (below) that appears when plotting (ignoring the print statements) related to the above issue with coordinate variables?</div><div style="margin-left:40px"><span style="font-family:monospace">(0)      check_for_y_lat_coord: Warning: Data either does not contain a valid latitude coordinate array or doesn't contain one at all.<br>(0)  A valid latitude coordinate array should have a 'units' attribute equal to one of the following values: <br>(0)       'degrees_north' 'degrees-north' 'degree_north' 'degrees north' 'degrees_N' 'Degrees_north' 'degree_N' 'degreeN' 'degreesN' 'deg north'<br>(0)       check_for_lon_coord: Warning: Data either does not contain a valid longitude coordinate array or doesn't contain one at all.<br>(0)   A valid longitude coordinate array should have a 'units' attribute equal to one of the following values: <br>(0)      'degrees_east' 'degrees-east' 'degree_east' 'degrees east' 'degrees_E' 'Degrees_east' 'degree_E' 'degreeE' 'degreesE' 'deg east'</span></div><div><br></div><div>Best,</div><div>Jayant<br></div></div>
_______________________________________________<br>
ncl-talk mailing list<br>
<a href="mailto:ncl-talk@mailman.ucar.edu" target="_blank">ncl-talk@mailman.ucar.edu</a><br>
List instructions, subscriber options, unsubscribe:<br>
<a href="https://mailman.ucar.edu/mailman/listinfo/ncl-talk" rel="noreferrer" target="_blank">https://mailman.ucar.edu/mailman/listinfo/ncl-talk</a></blockquote></div>
</blockquote></div>