<div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr">Dale, Rick:</div><div dir="ltr"><br></div><div dir="ltr">The scheme for storing 2-D coordinates in Netcdf files is described by an external convention, and is not part of the core Netcdf structure.  A full description is in CF Conventions (1.8) section 5.1.  By conforming to the convention, you enable the 2-D coordinates to be properly understood by a wide range of generic software, not just NCL.</div><div dir="ltr"><br></div><div dir="ltr">Here is an example of the bare minimum structure needed to conform.  There is a more complicated example in the CF document.</div><div dir="ltr"><br></div><div dir="ltr"><br></div><div dir="ltr"><br></div><div dir="ltr">xxxx</div><div dir="ltr"><div>xxx</div><div><br></div><div><br></div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, May 8, 2020 at 8:33 AM Rick Brownrigg via ncl-talk <<a href="mailto:ncl-talk@ucar.edu">ncl-talk@ucar.edu</a>> wrote:<br></div><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 dir="ltr"><div>Hi Dale,</div><div><br></div><div>You seem to be doing the proper things to attach coordinate variables to a variable. But by NetCDF convention (not due to NCL), "coordinate variables" are by definition !D arrays with a dimension name the same as the variable name.</div><div><br></div><div>If you have 2D coordinates, the technique is generally to assign those to special lat2d/lon2d *attributes* of the variable.  Check out the quote below and the web page it was taken from.</div><div><br></div><div>Rick<br></div><div><br></div><div>"To plot data on a curvilinear grid, you must read these 2D lat/lon
variables from the file and attach them to the data variable as special
attributes called "lat2d" and "lon2d":"</div><div>,,,</div><div><pre>  temp@lat2d = a->gridlat_236    ;     113 x 151
  temp@lon2d = a->gridlon_236    ;     113 x 151</pre><p>

</p><pre><a href="http://ncl.ucar.edu/Applications/plot_data_on_map.shtml" target="_blank">http://ncl.ucar.edu/Applications/plot_data_on_map.shtml</a><br><br></pre></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, May 8, 2020 at 3:33 AM dale zuri via ncl-talk <<a href="mailto:ncl-talk@ucar.edu" target="_blank">ncl-talk@ucar.edu</a>> wrote:<br></div><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 dir="ltr">Hi NCL user,<br><div>I have been trying to write a variable that is function of 2dlat/lon to the netcdf file. </div><div>I'm getting following error. I would appreciate any help to fix this error. </div><div><br></div><div>Thanks</div><div><br></div><div>





<p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo"><span style="font-variant-ligatures:no-common-ligatures">VRH!</span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(195,55,32)">0</span><span style="font-variant-ligatures:no-common-ligatures"><span>    </span>= </span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(195,55,32)">"lat2d"</span><span style="font-variant-ligatures:no-common-ligatures"><span>                      </span></span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(83,48,225)">; assign named dimensions</span></p>
<p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo"><span style="font-variant-ligatures:no-common-ligatures">VRH!</span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(195,55,32)">1</span><span style="font-variant-ligatures:no-common-ligatures"><span>    </span>= </span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(195,55,32)">"lon2d"</span></p>
<p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;min-height:13px"><span style="font-variant-ligatures:no-common-ligatures"></span><br></p>
<p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo"><span style="font-variant-ligatures:no-common-ligatures">VRH&lat2d<span>  </span>= lat2d <span>                    </span></span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(83,48,225)">; copy lat from T to ORO</span></p>
<p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo"><span style="font-variant-ligatures:no-common-ligatures">VRH&lat2d<span>  </span>= lon2d</span></p><p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo"><span style="font-variant-ligatures:no-common-ligatures"><br></span></p><p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo"><span style="font-variant-ligatures:no-common-ligatures">





</span></p><p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo"><span style="font-variant-ligatures:no-common-ligatures">ncdf->VRH = VRH <span> </span></span></p><p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo"><span style="font-variant-ligatures:no-common-ligatures"><span><br></span></span></p><p style="margin:0px;font-style:normal;font-variant-caps:normal;font-weight:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo"><span style="font-variant-ligatures:no-common-ligatures">Variable: VRH</span></p><p style="margin:0px;font-style:normal;font-variant-caps:normal;font-weight:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo"><span style="font-variant-ligatures:no-common-ligatures">Type: integer</span></p><p style="margin:0px;font-style:normal;font-variant-caps:normal;font-weight:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo"><span style="font-variant-ligatures:no-common-ligatures">Total Size: 491520 bytes</span></p><p style="margin:0px;font-style:normal;font-variant-caps:normal;font-weight:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo"><span style="font-variant-ligatures:no-common-ligatures"><span>            </span>122880 values</span></p><p style="margin:0px;font-style:normal;font-variant-caps:normal;font-weight:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo"><span style="font-variant-ligatures:no-common-ligatures">Number of Dimensions: 2</span></p><p style="margin:0px;font-style:normal;font-variant-caps:normal;font-weight:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo"><span style="font-variant-ligatures:no-common-ligatures">Dimensions and sizes:<span style="white-space:pre-wrap">    </span>[nj | 384] x [ni | 320]</span></p><p style="margin:0px;font-style:normal;font-variant-caps:normal;font-weight:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo"><span style="font-variant-ligatures:no-common-ligatures">Coordinates:<span> </span></span></p><p style="margin:0px;font-style:normal;font-variant-caps:normal;font-weight:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo"><span style="font-variant-ligatures:no-common-ligatures">Number Of Attributes: 3</span></p><p style="margin:0px;font-style:normal;font-variant-caps:normal;font-weight:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo"><span style="font-variant-ligatures:no-common-ligatures"><span>  </span>lat2d :<span style="white-space:pre-wrap">    </span><ARRAY of 122880 elements></span></p><p style="margin:0px;font-style:normal;font-variant-caps:normal;font-weight:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo"><span style="font-variant-ligatures:no-common-ligatures"><span>  </span>lon2d :<span style="white-space:pre-wrap"> </span><ARRAY of 122880 elements></span></p><p style="margin:0px;font-style:normal;font-variant-caps:normal;font-weight:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo"><span style="font-variant-ligatures:no-common-ligatures"><span>  </span>_FillValue :<span style="white-space:pre-wrap">    </span>-2147483647</span></p><p style="margin:0px;font-style:normal;font-variant-caps:normal;font-weight:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo"><span style="font-variant-ligatures:no-common-ligatures">fatal:Coordinate variables must have one dimension only</span></p><p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo"><span style="font-variant-ligatures:no-common-ligatures"><span>

















</span></span></p><p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo"><span style="font-variant-ligatures:no-common-ligatures">fatal:No coordinate variable exists for dimension (lat2d) in variable (VRH)</span></p></div></div></blockquote></div></blockquote></div></div></div></div></div>