<div dir="ltr"><div class="gmail_default" style="font-size:small">I think I understand, but you need to elaborate on what the issue was on the NCL end.</div><div class="gmail_default" style="font-size:small"><br></div>You stated, " It’s 2D but not Geo2D if you open it with eg, panoply."<div class="gmail_default" style="font-size:small;display:inline"> By this do you mean you were having trouble plotting it with NCL? If you tried plotting it with NCL and it wasn't right, it would help if you include the script, the image, and the error message if any.</div><div><br></div><div><div class="gmail_default" style="font-size:small;display:inline">--Mary</div></div><div><div class="gmail_default" style="font-size:small;display:inline"></div><div class="gmail_default" style="font-size:small"><br></div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, May 5, 2017 at 7:24 AM, Su, Jian (GSFC-610.2)[ADNET SYSTEMS INC] <span dir="ltr"><<a href="mailto:jian.su@nasa.gov" target="_blank">jian.su@nasa.gov</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div bgcolor="white" lang="EN-US" link="blue" vlink="purple">
<div class="m_608887073809405652WordSection1">
<p class="MsoNormal"><span style="font-family:Calibri">Thank you Mary,<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-family:Calibri"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-family:Calibri">An easy way to tell if it’s a Geo2D is, to open the file with panoply and plot a variable with Geo2D, you will see the global grid as well. Otherwise, just a rectangle region.<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-family:Calibri"><u></u> <u></u></span></p>
<div style="border:none;border-top:solid #b5c4df 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b><span style="font-family:Calibri;color:black">From: </span>
</b><span style="font-family:Calibri;color:black">Mary Haley <<a href="mailto:haley@ucar.edu" target="_blank">haley@ucar.edu</a>><br>
<b>Date: </b>Thursday, May 4, 2017 at 7:05 PM<span class=""><br>
<b>To: </b>"Su, Jian (GSFC-610.2)[ADNET SYSTEMS INC]" <<a href="mailto:jian.su@nasa.gov" target="_blank">jian.su@nasa.gov</a>><br>
</span><b>Cc: </b>Rick Brownrigg <<a href="mailto:brownrig@ucar.edu" target="_blank">brownrig@ucar.edu</a>>, "<a href="mailto:ncl-talk@ucar.edu" target="_blank">ncl-talk@ucar.edu</a>" <<a href="mailto:ncl-talk@ucar.edu" target="_blank">ncl-talk@ucar.edu</a>></span></p><div><div class="h5"><br>
<b>Subject: </b>Re: [ncl-talk] change dimensions to lat/lon<u></u><u></u></div></div><p></p>
</div><div><div class="h5">
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<div>
<p class="MsoNormal">Jian,<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">The first issue is that you cannot assign a missing value using a different type. For example, the following will produce the same error, because "x" is an integer array, and you are trying to assign a floating point _FillValue:<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<pre><span style="font-size:12.0pt"> x = (/1,2,3,4,5,-999/) ; x is an array of integers<u></u><u></u></span></pre>
<pre><span style="font-size:12.0pt"> x@_FillValue = -999. ; -999. is a float, which is a "higher" type than an integer<u></u><u></u></span></pre>
<p class="MsoNormal"><br>
The fix in your case would be to use "totype":<br>
<br>
<span style="font-family:"monospace","serif""> x@_FillValue = totype(x@CodeMissingValue,<wbr>typeof(x))</span><u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal"><span style="font-family:Arial">You have to be careful with this kind of assignment, however, because you could lose precision when going from a higher type to a lower type.</span><u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal"><span style="font-family:Arial">As for the second question, I'm not sure what you mean by "Geo2D". </span><u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal"><span style="font-family:Arial">--Mary</span><u></u><u></u></p>
</div>
<div>
<p class="MsoNormal" style="margin-bottom:12.0pt"><u></u> <u></u></p>
</div>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
<div>
<p class="MsoNormal">On Tue, May 2, 2017 at 8:44 AM, Su, Jian (GSFC-610.2)[ADNET SYSTEMS INC] <<a href="mailto:jian.su@nasa.gov" target="_blank">jian.su@nasa.gov</a>> wrote:<u></u><u></u></p>
<blockquote style="border:none;border-left:solid #cccccc 1.0pt;padding:0in 0in 0in 6.0pt;margin-left:4.8pt;margin-right:0in">
<div>
<div>
<p class="MsoNormal"><span style="font-family:Calibri">Thank you again Rick, and thank you Dennis.</span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-family:Calibri"> </span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-family:Calibri">There are still two issues:</span><u></u><u></u></p>
<p class="m_608887073809405652m-5995897457394344850msolistparagraph"><span style="font-family:Calibri">1.</span><span style="font-size:7.0pt">
</span><span style="font-family:Calibri">x@_FillValue = x@CodeMissingValue</span><u></u><u></u></p>
<p class="m_608887073809405652m-5995897457394344850msolistparagraph"><span style="font-family:Calibri">fatal:Type Mismatch: The type of missing value could not be converted to type of variable (x)</span><u></u><u></u></p>
<p class="m_608887073809405652m-5995897457394344850msolistparagraph"><span style="font-family:Calibri"> </span><u></u><u></u></p>
<p class="m_608887073809405652m-5995897457394344850msolistparagraph"><span style="font-family:Calibri">2.</span><span style="font-size:7.0pt">
</span><span style="font-family:Calibri">It’s 2D but not Geo2D if you open it with eg, panoply.</span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-family:Calibri"> </span><u></u><u></u></p>
<div style="border:none;border-top:solid #b5c4df 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b><span style="font-family:Calibri;color:black">From:
</span></b><span style="font-family:Calibri;color:black">Rick Brownrigg <<a href="mailto:brownrig@ucar.edu" target="_blank">brownrig@ucar.edu</a>><br>
<b>Date: </b>Tuesday, May 2, 2017 at 10:23 AM</span><u></u><u></u></p>
<div>
<div>
<p class="MsoNormal"><br>
<b>To: </b>"Su, Jian (GSFC-610.2)[ADNET SYSTEMS INC]" <<a href="mailto:jian.su@nasa.gov" target="_blank">jian.su@nasa.gov</a>><br>
<b>Cc: </b>"<a href="mailto:ncl-talk@ucar.edu" target="_blank">ncl-talk@ucar.edu</a>" <<a href="mailto:ncl-talk@ucar.edu" target="_blank">ncl-talk@ucar.edu</a>><br>
<b>Subject: </b>Re: [ncl-talk] change dimensions to lat/lon<u></u><u></u></p>
</div>
</div>
</div>
<div>
<div>
<div>
<p class="MsoNormal"> <u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">Hi Jian,
<u></u><u></u></p>
<div>
<p class="MsoNormal"> <u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">This is from my colleague Dennis Shea; it presumes you need to generate the actual lat/lon values:<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> <u></u><u></u></p>
</div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:9.5pt">Re: the hdf5 question ... a (720,1440) is a 'classic' 0.25 degree grid. This is offset from the poles an dateline by 0.125. The grisd point is the
cented of the local grid.</span><u></u><u></u></p>
</div>
<div>
<pre style="white-space:pre-wrap">nlat = 720<u></u><u></u></pre>
<pre>lat = <b>latGlobeFo</b>(nlat, "lat", "latitude", "degrees_north")<br>lat = lat(::-1) ; lat: [89.875..-89.875]<u></u><u></u></pre>
<pre style="white-space:pre-wrap">print(lat)<u></u><u></u></pre>
<pre style="white-space:pre-wrap">mlon = 1440<br>lon = <b>lonGlobeFo</b>(mlon, "lon", "longitude", "degrees_east")<br>lon = (/ lon - 180. /) ; subtract 180 from all values <u></u><u></u></pre>
<pre>lon&lon = lon ; update coordinate<u></u><u></u></pre>
<pre style="margin-bottom:12.0pt"><a href="http://www.ncl.ucar.edu/Document/Functions/Built-in/print.shtml" target="_blank"><b>print</b></a>(lon) ; lon: [-179.875..179.875]<u></u><u></u></pre>
<p class="MsoNormal"><span style="font-size:9.5pt"> </span><u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:9.5pt"> x = f->pixTot</span><u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:9.5pt"> x!0 = "lat"</span><u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:9.5pt"> x!1 = "lon"</span><u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:9.5pt"> x@_FillValue = x@CodeMissingValue</span><u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:9.5pt"> fout->pixTot = x</span><u></u><u></u></p>
</div>
</div>
<div>
<p class="MsoNormal"><span style="font-size:9.5pt"> </span><u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:9.5pt"> </span><u></u><u></u></p>
</div>
</div>
<div>
<p class="MsoNormal"> <u></u><u></u></p>
<div>
<p class="MsoNormal">On Tue, May 2, 2017 at 7:59 AM, Su, Jian (GSFC-610.2)[ADNET SYSTEMS INC] <<a href="mailto:jian.su@nasa.gov" target="_blank">jian.su@nasa.gov</a>> wrote:<u></u><u></u></p>
<blockquote style="border:none;border-left:solid #cccccc 1.0pt;padding:0in 0in 0in 6.0pt;margin-left:4.8pt;margin-top:5.0pt;margin-right:0in;margin-bottom:5.0pt">
<div>
<div>
<p class="MsoNormal"><span style="font-family:Calibri">Thank you Rick,</span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-family:Calibri"> </span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-family:Calibri">Filedimdef successfully added lat/lon, but how can we remove DIM_001/ DIM_002 and assign lat/lon to the variable pixTot?</span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-family:Calibri"> </span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-family:Calibri"> </span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-family:Calibri"> file global attributes:</span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-family:Calibri"> dimensions:</span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-family:Calibri"> DIM_001 = 1440</span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-family:Calibri"> DIM_002 = 720</span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-family:Calibri"> lat = 1440</span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-family:Calibri"> lon = 720</span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-family:Calibri"> variables:</span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-family:Calibri"> integer pixTot ( DIM_001, DIM_002 )</span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-family:Calibri"> CodeMissingValue : -9999</span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-family:Calibri"> DimensionNames : nlon,nlat</span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-family:Calibri"> </span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-family:Calibri"> </span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-family:Calibri"> </span><u></u><u></u></p>
<div style="border:none;border-top:solid #b5c4df 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b><span style="font-family:Calibri;color:black">From:
</span></b><span style="font-family:Calibri;color:black">Rick Brownrigg <<a href="mailto:brownrig@ucar.edu" target="_blank">brownrig@ucar.edu</a>><br>
<b>Date: </b>Monday, May 1, 2017 at 4:15 PM<br>
<b>To: </b>"Su, Jian (GSFC-610.2)[ADNET SYSTEMS INC]" <<a href="mailto:jian.su@nasa.gov" target="_blank">jian.su@nasa.gov</a>><br>
<b>Cc: </b>"<a href="mailto:ncl-talk@ucar.edu" target="_blank">ncl-talk@ucar.edu</a>" <<a href="mailto:ncl-talk@ucar.edu" target="_blank">ncl-talk@ucar.edu</a>><br>
<b>Subject: </b>Re: [ncl-talk] change dimensions to lat/lon</span><u></u><u></u></p>
</div>
<div>
<div>
<div>
<p class="MsoNormal"> <u></u><u></u></p>
</div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal" style="margin-bottom:12.0pt">Hi Jay,<u></u><u></u></p>
</div>
<p class="MsoNormal" style="margin-bottom:12.0pt">There are probably several ways to do this. One that occurs to me is to create the dimensions in the new file with the "filedimdef" procedure:<br>
<br>
<a href="http://ncl.ucar.edu/Document/Functions/Built-in/filedimdef.shtml" target="_blank">
http://ncl.ucar.edu/Document/<wbr>Functions/Built-in/filedimdef.<wbr>shtml</a><u></u><u></u></p>
</div>
<p class="MsoNormal" style="margin-bottom:12.0pt">So in your case, that might look something like:<br>
<br>
filedimdef(f,(/"lat","lon"/),(<wbr>/1440, 720/), (/False,False/))<u></u><u></u></p>
</div>
<p class="MsoNormal" style="margin-bottom:12.0pt">You can add the other information directly as global attributes of the file:<u></u><u></u></p>
</div>
<p class="MsoNormal"> f->LatitudeResolution=0.25<u></u><u></u></p>
</div>
<p class="MsoNormal"> f->LongitudeResolution=0.25<u></u><u></u></p>
</div>
<p class="MsoNormal" style="margin-bottom:12.0pt"> ...etc...<u></u><u></u></p>
</div>
<p class="MsoNormal">Hope that helps...<u></u><u></u></p>
</div>
<p class="MsoNormal">Rick<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> <u></u><u></u></p>
<div>
<p class="MsoNormal">On Mon, May 1, 2017 at 12:28 PM, Su, Jian (GSFC-610.2)[ADNET SYSTEMS INC] <<a href="mailto:jian.su@nasa.gov" target="_blank">jian.su@nasa.gov</a>> wrote:<u></u><u></u></p>
<blockquote style="border:none;border-left:solid #cccccc 1.0pt;padding:0in 0in 0in 6.0pt;margin-left:4.8pt;margin-top:5.0pt;margin-right:0in;margin-bottom:5.0pt">
<div>
<div>
<p class="MsoNormal">Hello,<u></u><u></u></p>
<p class="MsoNormal"> <u></u><u></u></p>
<p class="MsoNormal">I am using ncl to convert HDF5 files to netCDF, and one of them looks like this:<u></u><u></u></p>
<p class="MsoNormal"> <u></u><u></u></p>
<p class="MsoNormal">Variable: f<u></u><u></u></p>
<p class="MsoNormal">Type: file<u></u><u></u></p>
<p class="MsoNormal">filename: out<u></u><u></u></p>
<p class="MsoNormal">path: out.nc4<u></u><u></u></p>
<p class="MsoNormal"> file global attributes:<u></u><u></u></p>
<p class="MsoNormal"> dimensions:<u></u><u></u></p>
<p class="MsoNormal"> DIM_001 = 1440<u></u><u></u></p>
<p class="MsoNormal"> DIM_002 = 720<u></u><u></u></p>
<p class="MsoNormal"> variables:<u></u><u></u></p>
<p class="MsoNormal"> integer pixTot ( DIM_001, DIM_002 )<u></u><u></u></p>
<p class="MsoNormal"> CodeMissingValue : -9999<u></u><u></u></p>
<p class="MsoNormal"> DimensionNames : nlon,nlat<u></u><u></u></p>
<p class="MsoNormal"> <u></u><u></u></p>
<p class="MsoNormal"> <u></u><u></u></p>
<p class="MsoNormal">How can I change DIM_001 and DIM_002 to lat/lon, and add the grid information eg,<u></u><u></u></p>
<p class="MsoNormal"> <u></u><u></u></p>
<p class="MsoNormal">LatitudeResolution=0.25;<u></u><u></u></p>
<p class="MsoNormal">LongitudeResolution=0.25;<u></u><u></u></p>
<p class="MsoNormal">NorthBoundingCoordinate=90;<u></u><u></u></p>
<p class="MsoNormal">SouthBoundingCoordinate=-90;<u></u><u></u></p>
<p class="MsoNormal">EastBoundingCoordinate=180;<u></u><u></u></p>
<p class="MsoNormal">WestBoundingCoordinate=-180;<u></u><u></u></p>
<p class="MsoNormal"> <u></u><u></u></p>
<p class="MsoNormal">Thanks,<u></u><u></u></p>
<p class="MsoNormal">Jay<u></u><u></u></p>
<p class="MsoNormal"> <u></u><u></u></p>
<p class="MsoNormal"> <u></u><u></u></p>
</div>
</div>
<p class="MsoNormal" style="margin-bottom:12.0pt"><br>
______________________________<wbr>_________________<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" target="_blank">http://mailman.ucar.edu/<wbr>mailman/listinfo/ncl-talk</a><u></u><u></u></p>
</blockquote>
</div>
<p class="MsoNormal"> <u></u><u></u></p>
</div>
</div>
</div>
</div>
</div>
</blockquote>
</div>
<p class="MsoNormal"> <u></u><u></u></p>
</div>
</div>
</div>
</div>
</div>
<p class="MsoNormal" style="margin-bottom:12.0pt"><br>
______________________________<wbr>_________________<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" target="_blank">http://mailman.ucar.edu/<wbr>mailman/listinfo/ncl-talk</a><u></u><u></u></p>
</blockquote>
</div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
</div></div></div>
</div>
</blockquote></div><br></div>