Re: cd_inv_calendar

From: Mary Haley <haley_at_nyahnyahspammersnyahnyah>
Date: Thu Apr 25 2013 - 09:36:28 MDT

Hi Virginie,

When you post a new question, please use a new subject header.

When you say the history_interval line is in "WRF outputs", what type of file is "WRF outputs"?

If you mean that you just have an ASCII file called "namelist.input", and you want to read the integers off this file, then:

   intervals = asciiread("namelist.input",-1,"integer")

"intervals" will now be a one-dimensional array with three elements, each with the value 10. The "asciiread" function just goes through your ASCII file, from left-to-right, top-to-bottom, reading in integers until it hits the end of the file. Thus, if you had a file that had the following lines:

   history_interval = 10, 20, 30
40
50
ntime1 = 60
levels = 70 80 90 100
ntime2 = 110

then "intervals" would be a one-dimensional array with the values (/10,20,30,40,50,1,60,70,80,90,100,2,110/)
Note the "1" and "2" in the list. This is because "asciiread" will read *all* integers, including ones that are part of other strings, like "ntime2" and "ntime1".

'm assuming you must have other values in the namelist file, so the "asciiread" statement will have to be modified to reflect this.

--Mary

On Apr 25, 2013, at 3:50 AM, Virginie Hergault wrote:

> It works! Thank you!
>
> I have another question:
>
> I put in namelist.input:
>
> history_interval = 10, 10, 10,
>
> I would like to know how to get this data from WRF outputs to use it
> in a ncl function.
>
> Thank you again!
> Virginie
>
>
> 2013/4/24, Mary Haley <haley@ucar.edu>:
>> Try:
>>
>> units = "minutes since " + times(0)
>>
>> The "+" here serves as a string concatenator.
>>
>> --Mary
>>
>> On Apr 24, 2013, at 10:58 AM, Virginie Hergault
>> <virginie.hergault@gmail.com> wrote:
>>
>>> Hi all,
>>>
>>> I would to know how to get the duration between the first time of the
>>> wrf output (times(0)) and a fixed time.
>>>
>>> I tried to put:
>>>
>>> units = "minutes since times(0)"
>>> date = cd_inv_calendar(2004,03,15,00,00,00,units,0)
>>>
>>> In my case, times(0)=2004-03-14_00:00:00
>>>
>>> But I have this error:
>>> CDMS error: Error on character time conversion, string = times(0)
>>>
>>> Do you have a solution?
>>>
>>> Thanks!
>>> Virginie
>>> _______________________________________________
>>> 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

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Thu Apr 25 09:36:37 2013

This archive was generated by hypermail 2.1.8 : Fri Apr 26 2013 - 17:10:25 MDT