<div dir="ltr">Dave V,<div><br></div><div>You are asking for nanosecond accuracy over a time range of 31 years. This requires 60 bits of numeric precision. This exceeds the precision of data type double, which is commonly used for storing time in Netcdf files.</div><div><br></div><div>Several solutions come to mind. For ease of use and greatest compatibility, I recommend storing the time values as fixed length strings of Netcdf type character (*not* Netcdf "string"). Order the digits from greatest to least significance, and retain leading zeros in the substrings. Always use 4-digit year numbers.</div><div><br></div><div>Modifying your example slightly, I suggest a character template such as "YYYY-MM-DD HH:MM:SS.SSSSSSSSS".</div><div><br></div><div>Include a "units" attribute such as "date/time". Also include the "calendar" attribute set to "gregorian".</div><div><br></div><div>Other accurate solutions using pure numeric encoding are fairly easy with NCL and Netcdf, but they have compatibility issues. Do you really need pure numeric time values for your application?</div><div><br></div><div>--Dave A.</div><div><br><div class="gmail_extra"><br><div class="gmail_quote">On Mon, May 23, 2016 at 1:51 PM, Vollaro, David <span dir="ltr"><<a href="mailto:dvollaro@albany.edu" target="_blank">dvollaro@albany.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr">
<div style="font-size:12pt;color:#000000;background-color:#ffffff;font-family:Calibri,Arial,Helvetica,sans-serif">
<p>Hi,</p>
<p align="left">I have an ascii dataset that has data to nanosecond accuracy. I want to read it and store it as netCDF. I was going to try to set the output time variable with the unit attribute as:
<br>
</p>
<p align="left"> <span>tatts@units = "nanoseconds since 1985-01-01 00:00:00.00000000" </span></p>
<p align="left">However I am not sure how to convert the gregorian date: <br>
</p>
<p align="left">cd_inv_calendar does not have any parameters smaller than seconds.
<br>
</p>
<p align="left">Thanks for any help you can provide.</p>
<p><span>sample time: 01/16/15 02:56:50.724470242</span></p>
<p><span>Dave</span></p></div></div></blockquote></div></div></div></div>