<div dir="ltr"><div>I agree with DaveA. Use the original GRIB2 file. NCL makes it look like a variable on a netCDF file.<br></div><div><br></div><div>%> <a href="https://www.ncl.ucar.edu/Document/Tools/ncl_filedump.shtml"><b>ncl_filedump</b></a> new_100y_6h.grib2 | less</div><div><br></div><div><b>ncl_filedump</b> tells you how NCL 'sees' the file's contents.</div><div><b>ncl_filedump</b> has many options. For a single time step file, the default is to not show the time dimension.</div><div>For example, you can force a time dimension via</div><div><br></div><div><div>%> <a href="https://www.ncl.ucar.edu/Document/Tools/ncl_filedump.shtml"><b>ncl_filedump</b></a> new_100y_6h.grib2 -itime | less</div><div><br></div><div>===</div><div>From within a script, options may be ste via: <a href="https://www.ncl.ucar.edu/Document/Functions/Built-in/setfileoption.shtml"><b>setfileoption</b></a><br></div></div><div><pre><strong>setfileoption</strong>("grb","SingleElementDimensions","Initial_time") ; initial_time0_hours<br>fgrb = addfile("new_100y_6h.grib2","r")<br></pre></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Feb 24, 2020 at 4:48 PM Dave Allured - NOAA Affiliate 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"><div>It would be better to just read the original grib2 file directly with NCL, as long as your NCL version is recent enough to support that particular polar stereographic grid. If that works, then NCL should provide you with the proper 2-D coordinate arrays.</div><div><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Feb 24, 2020 at 4:01 PM Diana Stovern - NOAA Affiliate 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:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Hello everyone, <div><br></div><div>I'm running into a problem that I'm hoping someone here can help me out with. </div><div><br></div><div>I attached the ncl script I'm running but the netCDF file is too big, so I'll try my best to explain the problem and maybe someone can offer advice without having to run the script. </div><div><br></div><div>I'm working with netCDF grids that were originally converted from a grib2 file. The grib2 file contains a single grid of rainfall values (units are in inches) over the continental United States. The grid is on a polar stereographic projection where the lat and lon dimensions are 2D. The dimensions for lat and lon are both (881,1121). Hence, I had to define var@lat2d and var@lon2d in order for the rainfall data to plot correctly. When the file was converted to netCDF, somehow the lat2d and lon2d variables each became defined as an array of 987601 elements. Because lat2d and lon2d are now defined as a 1D array in the netCDF file, I get the following error from lines 29/30 of the attached NCL code where lat2d and lon2d are defined: </div><div><br></div><div><i>fatal:Dimensions of attribute and right-hand side of assignment do not match</i><br></div><div><br></div><div>If I remove/comment 29 and 30, I get: </div><div><br></div><div><i>(0) is_valid_latlon2d_attr: Warning: The 'lat2d' attribute must either be the same dimension sizes as the data, or one element larger in both directions. Your data will most likely not be overlaid on the map correctly.<br>(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) is_valid_latlon2d_attr: Warning: The 'lon2d' attribute must either be the same dimension sizes as the data, or one element larger in both directions. Your data will most likely not be overlaid on the map correctly.<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'</i><br></div><div><br></div><div>What fix should I apply to deal with the fact that lat2d and lon2d are defined as 1D arrays in my netCDF file? I think that if I can redefine lat2d and lon2d to turn them from a 1D array of 987601 elements back to 2D array of (881,1121) elements that it should fix the problem, but I don't know how to do that. </div><div><br></div><div>Or is there another fix that will at least get the data to plot? Right now, this netCDF file just does not want to plot no matter what I do. </div><div><br></div><div>Thanks for your help! Any insight is greatly appreciated! </div><div><br></div><div>- Diana</div></div></blockquote></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>