<div dir="ltr">Hi Jian,<div><br></div><div>This is from my colleague Dennis Shea; it presumes you need to generate the actual lat/lon values:</div><div><br></div><div><div style="font-size:12.800000190734863px">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.<br></div><div style="font-size:12.800000190734863px"><pre style="white-space:pre-wrap">nlat = 720
lat = <b>latGlobeFo</b>(nlat, "lat", "latitude", "degrees_north")<br>lat = lat(::-1) ; lat: [89.875..-89.875]<br></pre><pre style="white-space:pre-wrap">print(lat)<br></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
lon&lon = lon ; update coordinate
<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]<br><br></pre><br></div><div style="font-size:12.800000190734863px"> x = f->pixTot<br></div><div style="font-size:12.800000190734863px"> x!0 = "lat"<br></div><div style="font-size:12.800000190734863px"> x!1 = "lon"<br></div><div style="font-size:12.800000190734863px"> x@_FillValue = x@CodeMissingValue<br></div><div style="font-size:12.800000190734863px"> fout->pixTot = x</div></div><div style="font-size:12.800000190734863px"><br></div><div style="font-size:12.800000190734863px"><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, May 2, 2017 at 7:59 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_5326126726335142183WordSection1">
<p class="MsoNormal"><span style="font-family:Calibri">Thank you Rick,<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">Filedimdef successfully added lat/lon, but how can we remove DIM_001/ DIM_002 and assign lat/lon to the variable pixTot?<u></u><u></u></span></p><span class="">
<p class="MsoNormal"><span style="font-family:Calibri"><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"> file global attributes:<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-family:Calibri"> dimensions:<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-family:Calibri"> DIM_001 = 1440<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-family:Calibri"> DIM_002 = 720<u></u><u></u></span></p>
</span><p class="MsoNormal"><span style="font-family:Calibri"> lat = 1440<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-family:Calibri"> lon = 720<u></u><u></u></span></p><span class="">
<p class="MsoNormal"><span style="font-family:Calibri"> variables:<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-family:Calibri"> integer pixTot ( DIM_001, DIM_002 )<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-family:Calibri"> CodeMissingValue : -9999<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-family:Calibri"> DimensionNames : nlon,nlat<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"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-family:Calibri"><u></u> <u></u></span></p>
</span><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<u></u><u></u></span></p>
</div><div><div class="h5">
<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-right:0in">
<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><br></div>