<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> </head> <body> <p>Indri,</p> <p>What you want to do can be easily done in python once you've installed the python-netcdf module (<a class="moz-txt-link-freetext" href="https://pypi.org/project/netCDF4/">https://pypi.org/project/netCDF4/</a>), as follows:</p> <p><tt>with Dataset('file_name.nc', 'a') as fid:<br> fid.START_DATE = '2000-01-01_00:10:00' # or whatever date you want<br> fid.SIMULATION_START_DATE = </tt><tt>'2000-01-01_00:10:00'</tt><tt> # or whatever date you want</tt></p> <p>-Sourish<br> </p> <div class="moz-cite-prefix">On 1/27/21 9:05 PM, Dave Allured - NOAA Affiliate via netcdfgroup wrote:<br> </div> <blockquote type="cite" cite="mid:CALqwTFPOdS14WxeiXEqsfd1eeMa=aJgXM3-wSRHmKObr0LrqtA@xxxxxxxxxxxxxx"> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <div dir="ltr"> <div dir="ltr"> <div dir="ltr"> <div dir="ltr"> <div dir="ltr"> <div dir="ltr"> <div>Indri,</div> <div><br> </div> <div>Please keep the conversation on the mailing list by using CC or Reply All.</div> <br> The attributes that you highlighted are simple text strings, which are easy to change. This can be done on the unix command line with no programming, with freeware packages such as <b>NCO</b> (NetCDF Operators). There are several examples in the description of the <b>ncatted</b> utility (attribute editor) in the <b>NCO</b> documentation:</div> <div dir="ltr"><br> </div> <div dir="ltr"><a href="http://nco.sourceforge.net/nco.html#ncatted-netCDF-Attribute-Editor" moz-do-not-send="true">http://nco.sourceforge.net/nco.html#ncatted-netCDF-Attribute-Editor</a><br> </div> <div dir="ltr"><br> </div> <div>Here is an example that might work on your actual data file:</div> <div><br> </div> <div>ncatted -h -a START_DATE,global,o,c,'2099-01-01_18:00:00' \<br> -a SIMULATION_START_DATE,global,o,c,'2099-01-01_18:00:00' <a href="http://secure-web.cisco.com/15UpK_qXQipNPj29wABooUgAEweu6vWVt23pl4rdU3XLc-tWRmzn_f7YrJO7TW4INsk75toW3B11QxMe9xcUrWunadF6w57hf1yMhhCk6NKAXd0PMOOBqsK6oZAx1i3NXtn7FvyD2m8yUd63WDl6Npg4KXfsNweTXoMMk_BZFj_uyrTzGsXsptDyNihwEO2cuppCU2vBakF8cosSQn-9vTwQmtljhatnIzA6JqRZKzVioLm33qk0uu3eLmM-nFES5deEBHANFR2NEc72o1GqOh9mdvP15BmXfWuLbIuBaGifydggMlje3KzLpBGxsm1LYyu_PfMkTuherydunJgxwK8PIkdSen5DwsSX_jp4BVxWB5krdwiv5CNb86SHHV2lRYi0sUqJlVM6wi-nKoVFknD8rgRNaLTVxUcD878WcYGVPLEY1WhlrVTaPLiU29TdK/http%3A%2F%2Ffilename.nc" moz-do-not-send="true">filename.nc</a><br> <br> </div> <div>I am sure there is also an easy way to do this in python. Perhaps one of the python programmers here can give an example.</div> <div dir="ltr"> <div dir="ltr"><br> </div> <br> <div class="gmail_quote"> <div dir="ltr" class="gmail_attr">On Wed, Jan 27, 2021 at 5:36 PM Miranti Indri Hastuti <<a href="mailto:mirantihastuti@xxxxxxxxx" moz-do-not-send="true">mirantihastuti@xxxxxxxxx</a>> wrote:<br> </div> <blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"> <div dir="ltr"> <div dir="ltr"> <div style="font-family:"comic sans ms",sans-serif">Hi Dave,</div> <div style="font-family:"comic sans ms",sans-serif"><br> </div> <div style="font-family:"comic sans ms",sans-serif">Thank you for answering my question,</div> <div style="font-family:"comic sans ms",sans-serif">what I'm going to edit is to change the attributes of ncfile, for example :</div> <div style="font-family:"comic sans ms",sans-serif"><img src="cid:part4.E6B839BE.0557EB42@colorado.edu" alt="image.png" class="" width="546" height="331"><br> </div> <div style="font-family:"comic sans ms",sans-serif">In this ncdef file, I want to change start date and simulation start date. Is that possible?</div> <div style="font-family:"comic sans ms",sans-serif">And my language programming is python.</div> <div style="font-family:"comic sans ms",sans-serif"><br> </div> <div style="font-family:"comic sans ms",sans-serif">I am really grateful for your help for answering my questions associated on my research.<br> </div> <div style="font-family:"comic sans ms",sans-serif">Thank you in advance.</div> <div style="font-family:"comic sans ms",sans-serif"><br> </div> <div style="font-family:"comic sans ms",sans-serif">sincerely </div> <div style="font-family:"comic sans ms",sans-serif"><br> </div> <div style="font-family:"comic sans ms",sans-serif">Indri</div> <div style="font-family:"comic sans ms",sans-serif"><br> </div> </div> </div> <br> <div class="gmail_quote"> <div dir="ltr" class="gmail_attr">On Thu, Jan 28, 2021 at 7:34 AM Dave Allured - NOAA Affiliate <<a href="mailto:dave.allured@xxxxxxxx" target="_blank" moz-do-not-send="true">dave.allured@xxxxxxxx</a>> wrote:<br> </div> <blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"> <div dir="ltr"> <div>Indri, there is more than one way to store date and time in a netcdf file. Please show an actual short example, and describe the general nature of how you want to change it. Also, what programming languages do you like to use for data work?</div> <div dir="ltr"><br> </div> <br> <div class="gmail_quote"> <div dir="ltr" class="gmail_attr">On Sat, Jan 23, 2021 at 8:50 AM Miranti Indri Hastuti <<a href="mailto:mirantihastuti@xxxxxxxxx" target="_blank" moz-do-not-send="true">mirantihastuti@xxxxxxxxx</a>> wrote:<br> </div> <blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"> <div dir="ltr"> <div dir="ltr"> <div style="font-family:"comic sans ms",sans-serif"> <div style="font-family:Arial,Helvetica,sans-serif"><font style="font-family:"comic sans ms",sans-serif" color="#24292e">Hi my name is Indri. I want to change the date and time on my netcdf data. So, i</font><span style="font-family:"comic sans ms",sans-serif">s there a way to edit date and time on the netcdf data?</span></div> <div style="font-family:Arial,Helvetica,sans-serif"><font face="comic sans ms, sans-serif"><br> </font></div> <div style="font-family:Arial,Helvetica,sans-serif"><font face="comic sans ms, sans-serif">I am really grateful for your help for answering my questions associated on my research.</font></div> <div style="font-family:Arial,Helvetica,sans-serif"><font face="comic sans ms, sans-serif">Thank you very much.</font></div> <div style="font-family:Arial,Helvetica,sans-serif"><font face="comic sans ms, sans-serif"><br> </font></div> <div style="font-family:Arial,Helvetica,sans-serif"><font face="comic sans ms, sans-serif">Best Regards</font></div> <font style="font-family:Arial,Helvetica,sans-serif" color="#888888"> <div><font face="comic sans ms, sans-serif">Miranti Indri,</font></div> </font></div> </div> </div> </blockquote> </div> </div> </blockquote> </div> </blockquote> </div> </div> </div> </div> </div> </div> </div> <br> <fieldset class="mimeAttachmentHeader"></fieldset> <pre class="moz-quote-pre" wrap="">_______________________________________________ NOTE: All exchanges posted to Unidata maintained email lists are recorded in the Unidata inquiry tracking system and made publicly available through the web. Users who post to any of the lists we maintain are reminded to remove any personal information that they do not want to be made public. netcdfgroup mailing list <a class="moz-txt-link-abbreviated" href="mailto:netcdfgroup@xxxxxxxxxxxxxxxx">netcdfgroup@xxxxxxxxxxxxxxxx</a> For list information or to unsubscribe, visit: <a class="moz-txt-link-freetext" href="https://www.unidata.ucar.edu/mailing_lists/">https://www.unidata.ucar.edu/mailing_lists/</a> </pre> </blockquote> </body> </html>
Attachment:
signature.asc
Description: OpenPGP digital signature
netcdfgroup
archives: