<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><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">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">ncl-talk@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">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:11px Menlo"><span style="font-variant-ligatures:no-common-ligatures">Variable: VRH</span></p><p style="margin:0px;font:11px Menlo"><span style="font-variant-ligatures:no-common-ligatures">Type: integer</span></p><p style="margin:0px;font:11px Menlo"><span style="font-variant-ligatures:no-common-ligatures">Total Size: 491520 bytes</span></p><p style="margin:0px;font:11px Menlo"><span style="font-variant-ligatures:no-common-ligatures"><span> </span>122880 values</span></p><p style="margin:0px;font:11px Menlo"><span style="font-variant-ligatures:no-common-ligatures">Number of Dimensions: 2</span></p><p style="margin:0px;font:11px 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:11px Menlo"><span style="font-variant-ligatures:no-common-ligatures">Coordinates:<span> </span></span></p><p style="margin:0px;font:11px Menlo"><span style="font-variant-ligatures:no-common-ligatures">Number Of Attributes: 3</span></p><p style="margin:0px;font:11px 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:11px 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:11px 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:11px 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>
_______________________________________________<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></blockquote></div>