Hi Nicole,
Is this a WRF file? Not that this changes what code you use, but that's just how they write their tine variable.
You will first need to read the times off the file and convert it to string. If this is a WRF file, then "wrf_user_list_times" does this for you:
times = wrf_user_list_times(a)
This will work too:
times = tostring(a->Times)
Then, to replace all "-05-", use "str_sub_str":
times_fix = str_sub_str(times,"-05-","-06-")
To write back out to the file:
a->Times = times_fix
--Mary
On May 2, 2013, at 3:55 PM, Nicole Mölders wrote:
> Dear all,
>
> I have a nedcdf file that I will have to use over and over again for new
> dates. Unfortunately it has the time variable written in there as
> char Times(Time, DateStrLen)
> with
> Times =
> "2005-05-17_00:00:00",
> "2005-05-17_01:00:00",
> "2005-05-17_02:00:00",
> .
> .
> .
> "2005-05-17_23:00:00",
> For the next year I want to use the same input and just have to change
> the 05 to a 06. How can I do this? I have to do this for data of an
> entire season. Thus I need an efficient way to do this. Thank you very
> much in advance for your help.
>
> Nicole
>
> --
> Dr. habil. rer. nat. Nicole Mölders, PhD
> aka Carmen N. Moelders
>
> Professor of Atmospheric Sciences
> Founding chair of the Department of Atmospheric Sciences
> Editor-in-Chief of Climate
>
> University of Alaska Fairbanks
> Geophysical Institute & College of Natural Science and Mathematics
> Department of Atmospheric Sciences
> 903 Koyukuk Drive
> Fairbanks, AK 99775-7320, USA
>
> Phone: +1 907 474 7910
> Fax: +1 907 474 7290
> URL: http://www.gi.alaska.edu/~molders, http://www.mdpi.com/journal/climate
> Email: molders@gi.alaska.edu
>
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Fri May 3 08:05:30 2013
This archive was generated by hypermail 2.1.8 : Tue May 07 2013 - 08:38:33 MDT