<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Mark,<div>If your original data set "wraps" the globe, then it should work fine:&nbsp;</div><div><br></div><div>'sdfopen foo.nc</div><div>'set lon -180 180'</div><div>'define var'</div><div>'sdfwrite var'</div><div><br></div><div>If not, please send the output from ncdump -c on your original file, your script to generate a new netcdf file using sdfwrite, and the output from ncdump -c on your new netcdf file. Your GrADS version would be helpful too.</div><div><br></div><div>--Jennifer</div><div><br></div><div><div><div>On Apr 13, 2012, at 7:36 PM, Mark Hess wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div>Thanks Chuck - Looks like that validates my suspicion that I cannot change <br>the lon coordinates from the 0-360 to world coordinates 180 to -180 when <br>extracting a subset of the original file to a smaller .nc file. &nbsp;I'll <br>consider different options. &nbsp;Thanks. &nbsp;Mark.<br><br><br>----- Original Message ----- <br>From: "Charles Seman" &lt;<a href="mailto:charles.seman@noaa.gov">charles.seman@noaa.gov</a>&gt;<br>To: "GrADS Users Forum" &lt;<a href="mailto:gradsusr@gradsusr.org">gradsusr@gradsusr.org</a>&gt;<br>Sent: Thursday, April 12, 2012 3:44 PM<br>Subject: Re: [gradsusr] Saving NetCDF lon parameter in geographic<br><br><br><blockquote type="cite">Mark,<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">The documentation at<br></blockquote><blockquote type="cite"><a href="http://grads.iges.org/grads/gadoc/gradcomdsdfwrite.html">http://grads.iges.org/grads/gadoc/gradcomdsdfwrite.html</a> states:<br></blockquote><blockquote type="cite">"By default, the output file will have a coordinate variable only for<br></blockquote><blockquote type="cite">varying dimensions in the defined variable; non-varying dimensions will<br></blockquote><blockquote type="cite">not appear as a coordinate variable with a size of 1. However, as of<br></blockquote><blockquote type="cite">version 2.0.a5, options have been added to the set sdfwrite command to<br></blockquote><blockquote type="cite">force the variable in the output file to have at least 4 or all 5<br></blockquote><blockquote type="cite">dimensions. When either of these options to set sdfwrite are used, the<br></blockquote><blockquote type="cite">output file will retain information about the values of the dimensions<br></blockquote><blockquote type="cite">that were fixed when the variable was defined; non-varying dimensions<br></blockquote><blockquote type="cite">will appear as a coordinate variable of size 1. For example, if your<br></blockquote><blockquote type="cite">defined variable is 500mb height on14may2002 (a 2D variable that varies<br></blockquote><blockquote type="cite">only in lon and lat), and you use the -4d option, the output file with<br></blockquote><blockquote type="cite">show height as a 4D variable with a Z dimension of size 1 called 'lev'<br></blockquote><blockquote type="cite">with a value "500 mb", and a T dimension of size 1 called 'time' with a<br></blockquote><blockquote type="cite">value of "0 minutes since 2002-05-14 00:00".<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">Seems the key phrase seems to be "the output file will retain<br></blockquote><blockquote type="cite">information about the values of the dimensions that were fixed when the<br></blockquote><blockquote type="cite">variable was defined"... I confirmed what I thought this meant on a file<br></blockquote><blockquote type="cite">which has grid longitudes in the -180 to 180 range and found the<br></blockquote><blockquote type="cite">following results:<br></blockquote><blockquote type="cite">--------------------------------------------------------------------<br></blockquote><blockquote type="cite">...using "native" longitude range:<br></blockquote><blockquote type="cite">ga-&gt; sdfopen 3B42.1002.V6.nc<br></blockquote><blockquote type="cite">Scanning self-describing file: &nbsp;3B42.1002.V6.nc<br></blockquote><blockquote type="cite">SDF file 3B42.1002.V6.nc is open as file 1<br></blockquote><blockquote type="cite">LON set to 0 360<br></blockquote><blockquote type="cite">LAT set to -49.875 49.875<br></blockquote><blockquote type="cite">LEV set to 0 0<br></blockquote><blockquote type="cite">Time values set: 2010:2:14:22 2010:2:14:22<br></blockquote><blockquote type="cite">E set to 1 1<br></blockquote><blockquote type="cite">ga-&gt; q file<br></blockquote><blockquote type="cite">File 1 : NASA TRMM 3B42 3-Hourly 0.25 degree TRMM and Other Satellites<br></blockquote><blockquote type="cite">Precipitation Product (Version 6)<br></blockquote><blockquote type="cite"> &nbsp;Descriptor: 3B42.1002.V6.nc<br></blockquote><blockquote type="cite"> &nbsp;Binary: 3B42.1002.V6.nc<br></blockquote><blockquote type="cite"> &nbsp;Type = Gridded<br></blockquote><blockquote type="cite"> &nbsp;Xsize = 1440 &nbsp;Ysize = 400 &nbsp;Zsize = 1 &nbsp;Tsize = 1 &nbsp;Esize = 1<br></blockquote><blockquote type="cite"> &nbsp;Number of Variables = 2<br></blockquote><blockquote type="cite"> &nbsp;&nbsp;&nbsp;&nbsp;precipitation &nbsp;0 &nbsp;t,y,x &nbsp;precipitation<br></blockquote><blockquote type="cite"> &nbsp;&nbsp;&nbsp;&nbsp;relativeerror &nbsp;0 &nbsp;t,y,x &nbsp;relativeError<br></blockquote><blockquote type="cite">ga-&gt; set lon -180 180<br></blockquote><blockquote type="cite">LON set to -180 180<br></blockquote><blockquote type="cite">ga-&gt; set lat -90 90<br></blockquote><blockquote type="cite">LAT set to -90 90<br></blockquote><blockquote type="cite">ga-&gt; set sdfwrite precipitation.3B42.1002.V6.nc<br></blockquote><blockquote type="cite">SDFWrite file name = precipitation.3B42.1002.V6.nc<br></blockquote><blockquote type="cite">SDFWrite will replace an existing file<br></blockquote><blockquote type="cite">ga-&gt; sdfwrite precipitation<br></blockquote><blockquote type="cite">SDFWRITE error: no defined variables<br></blockquote><blockquote type="cite">ga-&gt; define precipitation = precipitation<br></blockquote><blockquote type="cite">Define memory allocation size = 8328992 bytes<br></blockquote><blockquote type="cite">ga-&gt; sdfwrite precipitation<br></blockquote><blockquote type="cite">Wrote variable precipitation to precipitation.3B42.1002.V6.nc<br></blockquote><blockquote type="cite">...<br></blockquote><blockquote type="cite">cjs: /tmp/data/precip/trmm/3B42.V6/pp/0.25x0.25/av/monthly/update/ --&gt;<br></blockquote><blockquote type="cite">\ncdump -c precipitation.3B42.1002.V6.nc<br></blockquote><blockquote type="cite">netcdf precipitation.3B42.1002.V6 {<br></blockquote><blockquote type="cite">dimensions:<br></blockquote><blockquote type="cite"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;longitude = 1442 ;<br></blockquote><blockquote type="cite"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;latitude = 722 ;<br></blockquote><blockquote type="cite">...<br></blockquote><blockquote type="cite"> longitude = -180.125,...,180.125<br></blockquote><blockquote type="cite"> latitude = -90.125,...,90.125<br></blockquote><blockquote type="cite">...<br></blockquote><blockquote type="cite">...so the output file runs from longitude = -180.125 to 180.125 and from<br></blockquote><blockquote type="cite">latitude = -90.125 to 90.125 (a couple extra points added in each<br></blockquote><blockquote type="cite">direction, so be careful)<br></blockquote><blockquote type="cite">--------------------------------------------------------------------<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">--------------------------------------------------------------------<br></blockquote><blockquote type="cite">...using a "global" longitude range, using x,y coordinates to define<br></blockquote><blockquote type="cite">exact boundaries:<br></blockquote><blockquote type="cite">ga-&gt; sdfopen 3B42.1002.V6.nc<br></blockquote><blockquote type="cite">Scanning self-describing file: &nbsp;3B42.1002.V6.nc<br></blockquote><blockquote type="cite">SDF file 3B42.1002.V6.nc is open as file 1<br></blockquote><blockquote type="cite">LON set to 0 360<br></blockquote><blockquote type="cite">LAT set to -49.875 49.875<br></blockquote><blockquote type="cite">LEV set to 0 0<br></blockquote><blockquote type="cite">Time values set: 2010:2:14:22 2010:2:14:22<br></blockquote><blockquote type="cite">E set to 1 1<br></blockquote><blockquote type="cite">...<br></blockquote><blockquote type="cite">ga-&gt; set y 1 400<br></blockquote><blockquote type="cite">LAT set to -49.875 49.875<br></blockquote><blockquote type="cite">ga-&gt; set x 721 2160<br></blockquote><blockquote type="cite">LON set to 0.125 359.875<br></blockquote><blockquote type="cite">ga-&gt; set sdfwrite precipitation.3B42.1002.V6.nc<br></blockquote><blockquote type="cite">SDFWrite file name = precipitation.3B42.1002.V6.nc<br></blockquote><blockquote type="cite">SDFWrite will replace an existing file<br></blockquote><blockquote type="cite">ga-&gt; define precipitation = precipitation<br></blockquote><blockquote type="cite">Define memory allocation size = 4608000 bytes<br></blockquote><blockquote type="cite">ga-&gt; sdfwrite precipitation<br></blockquote><blockquote type="cite">Wrote variable precipitation to precipitation.3B42.1002.V6.nc<br></blockquote><blockquote type="cite">cjs: /tmp/data/precip/trmm/3B42.V6/pp/0.25x0.25/av/monthly/update/ --&gt;<br></blockquote><blockquote type="cite">\ncdump -c precipitation.3B42.1002.V6.nc<br></blockquote><blockquote type="cite">netcdf precipitation.3B42.1002.V6 {<br></blockquote><blockquote type="cite">dimensions:<br></blockquote><blockquote type="cite"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;longitude = 1440 ;<br></blockquote><blockquote type="cite"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;latitude = 400 ;<br></blockquote><blockquote type="cite"> longitude = 0.125,...,359.875<br></blockquote><blockquote type="cite"> latitude = -49.875,...,49.875<br></blockquote><blockquote type="cite">...<br></blockquote><blockquote type="cite">...so the output file runs from longitude = 0.125,...,359.8755 and from<br></blockquote><blockquote type="cite">latitude = -49.875,...,49.875<br></blockquote><blockquote type="cite">--------------------------------------------------------------------<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">Could you try defining the variable to sdfwrite using parameters<br></blockquote><blockquote type="cite">appropriate to the netCDF file's original grid?<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">Hope this helps,<br></blockquote><blockquote type="cite">Chuck<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">On 04/12/2012 03:57 PM, Mark Hess wrote:<br></blockquote><blockquote type="cite"><blockquote type="cite">I have a NetCDF file which I can ingest and display in GrADS with out a<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">problem. The LON parameter is set to a 0-360 grid as opposed to 0-180W &amp;<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">0-180E (or 0 to 180 for east and 0 to -180 for west). If I "set lon 239<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">244" and then display my variable of interest (in this case U), the data<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">display properly showing the data between 116W-121W (116W equaling<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">-116=244-360 and 121W equaling -121=360-239). That all is fine until I<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">try to save my geographically subsetted area to a new .nc file using the<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">sdfwrite function. The file saves fine, but it saves the LON information<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">in the 0-360 format instead of the 0 to -180 format which I need for<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">another application. Is there a way to either 1) save the new, subsetted<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">.nc file with the lons converting to the in 0 to -180 format as part of<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">the process or 2) convert the lon format within GrADS first and then<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">save the new .nc file with the lon values in the format I want? Can I<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">subtract 360 from my "lon" variable to create a 'new' lon variable?<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">Thanks,<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">Mark<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">_______________________________________________<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">gradsusr mailing list<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><a href="mailto:gradsusr@gradsusr.org">gradsusr@gradsusr.org</a><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><a href="http://gradsusr.org/mailman/listinfo/gradsusr">http://gradsusr.org/mailman/listinfo/gradsusr</a><br></blockquote></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">-- <br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">Please note that <a href="mailto:Charles.Seman@noaa.gov">Charles.Seman@noaa.gov</a> should be considered my NOAA<br></blockquote><blockquote type="cite">email address, not <a href="mailto:cjs@gfdl.noaa.gov">cjs@gfdl.noaa.gov</a>.<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">********************************************************************<br></blockquote><blockquote type="cite"> Charles Seman &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="mailto:Charles.Seman@noaa.gov">Charles.Seman@noaa.gov</a><br></blockquote><blockquote type="cite"> U.S. Department of Commerce / NOAA / OAR<br></blockquote><blockquote type="cite"> Geophysical Fluid Dynamics Laboratory &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;voice: (609) 452-6547<br></blockquote><blockquote type="cite"> 201 Forrestal Road &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;fax: (609) 987-5063<br></blockquote><blockquote type="cite"> Princeton, NJ &nbsp;08540-6649 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="http://www.gfdl.noaa.gov/~cjs/">http://www.gfdl.noaa.gov/~cjs/</a><br></blockquote><blockquote type="cite">********************************************************************<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">"The contents of this message are mine personally and do not reflect any<br></blockquote><blockquote type="cite">official or unofficial position of the United States Federal Government,<br></blockquote><blockquote type="cite">the United States Department of Commerce, or NOAA."<br></blockquote><blockquote type="cite">_______________________________________________<br></blockquote><blockquote type="cite">gradsusr mailing list<br></blockquote><blockquote type="cite"><a href="mailto:gradsusr@gradsusr.org">gradsusr@gradsusr.org</a><br></blockquote><blockquote type="cite"><a href="http://gradsusr.org/mailman/listinfo/gradsusr">http://gradsusr.org/mailman/listinfo/gradsusr</a> <br></blockquote><br>_______________________________________________<br>gradsusr mailing list<br><a href="mailto:gradsusr@gradsusr.org">gradsusr@gradsusr.org</a><br>http://gradsusr.org/mailman/listinfo/gradsusr<br></div></blockquote></div><br><div apple-content-edited="true">
<span class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><span class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><span class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><div>--</div><div>Jennifer M. Adams</div><div>IGES/COLA</div><div>4041 Powder Mill Road, Suite 302</div><div>Calverton, MD 20705</div><div><a href="mailto:jma@cola.iges.org">jma@cola.iges.org</a></div><div><br class="khtml-block-placeholder"></div><br class="Apple-interchange-newline"></span></span></span>
</div>
<br></div></body></html>