[ncl-talk] eof script problems
James Ciarlo`
james.ciarlo at physics.org
Mon Aug 25 09:40:28 MDT 2014
Hi,
Thank you Will and Dennis, I have managed to modify my script to make it
work for my data.
Since I am not interested in the time series plot but just the data I have
prepared the second part of the script to write text files. I have read the
manual, looked up on the ncl-talk archives and managed to get it to work,
but it is not working properly and I cannot identify how to fix the
problem.
The script should be producing 1 text file per EOF, each containing a date
and the corresponding eof_ts value. There are two problems with it. First,
all date values are 1970 and each text file is printing values
corresponding to both neof quantities (however, the first one is being
marked as missing) - this latter problem is not really that much of an
issue. if I could solve the first problem I could get by.
Thanks and regards,
James
On 14 August 2014 15:53, Dennis Shea <shea at ucar.edu> wrote:
> Sometimes, when people answer, they are quickly typing and make errors.
>
> Will had a typo. He meant 'ispan' .....
> This is one of the most basic functions in NCL. Please read documentation:
> https://www.ncl.ucar.edu/Document/Functions/Built-in/ispan.shtml
>
> year = ispan(yrst, yren,1) ; integer array of all years in
> the range
>
>
>
>
>
> On Thu, Aug 14, 2014 at 6:29 AM, James Ciarlo` <james.ciarlo at physics.org>
> wrote:
>
>> Hi Will,
>>
>> Thanks for your help. However, the span command was not recognized.
>>
>> Regards,
>> James
>>
>>
>> On 14 August 2014 09:08, Will Hobbs <Will.Hobbs at utas.edu.au> wrote:
>>
>>> James
>>>
>>> As the name of function might suggest month_to_season() is designed to
>>> convert monthly data to seasonal data; it's not designed to work with
>>> 4xtimes daily data. If in doubt about any function, your first step should
>>> ALWAYS be to consult the NCL help page for that function (
>>> http://www.ncl.ucar.edu/Document/Functions/Contributed/month_to_season.shtml
>>> )
>>>
>>> There is a page listing all of NCL's functions:
>>> http://www.ncl.ucar.edu/Document/Functions/climo.shtml, at the moment
>>> they only work with monthly or daily data, so you will have to use a
>>> different approach.
>>>
>>> My advise would be to use one of NCL's date functions (
>>> http://www.ncl.ucar.edu/Document/Functions/date.shtml) to find all the
>>> data points for a given season. I've given an example below to calculate
>>> the seasonal mean for Jan-Mar (JFM), whcih you can adjust to your own
>>> purposes. This assumes that your data has an appropriate time coord system,
>>> which I'm calling 'time' here. Lt's say you have an array, x, dimensioned
>>> (time,lat,lon)
>>>
>>> > nyr = yren - yrst+1 ;yrst and yren are the forst and last years
>>> in x
>>> > xSeas = x(:nyr-1,:,:) ; nyr is the number of years in your data set
>>> >year = span(yrst, yren,1) ; integer array of all years in
>>> the range
>>> > tdat = cd_calendar(x&time, -5) ; converts time to a multidimensional
>>> array giving year, month, day, time etc for each time step
>>>
>>> > do yy = 0, nyr-1
>>> > ii =
>>> ind(tdat(:,0).eq.year(yy).and.tdat(:,1).ge.1.and.tdat(:,1).le.3) ;location
>>> of all times in given year, that are between Jan (1) and March(3)
>>> > xSeas(yy,:,:) = dim_avg_n(x(ii,:,:), 0) ; get average of all
>>> those data points
>>> > delete(ii)
>>> > end do
>>>
>>>
>>> Hope that helps. Don't forget that there is an enormous amount of help
>>> to be gained by on the NCL website; it has a search function which includes
>>> archived 'ncl-talk' posts. Nine times out of ten somebody else will have
>>> come across the same problem.
>>>
>>> Will
>>>
>>>
>>>
>>>
>>> From: James Ciarlo` <james.ciarlo at physics.org>
>>> Date: Thursday, 14 August 2014 4:43 PM
>>> To: "ncl-talk at ucar.edu" <ncl-talk at ucar.edu>
>>> Subject: [ncl-talk] eof script problems
>>>
>>> Dear NCL users,
>>>
>>> I am new to NCL and am trying to modify an eof script to suit a
>>> different dataset.
>>>
>>> The data the script is designed for uses a command month_to_season but
>>> since my data is not monthly but rather 4 time daily, I need an alternative
>>> method. And in fact running the script gives me the following error (to
>>> start with, as I am sure fixing this will result in numerous other errors
>>> later but lets start with this)
>>>
>>> (0) contributed.ncl: month_to_season: dimension must be a multiple
>>> of 12
>>>
>>> Regards,
>>> James
>>>
>>
>>
>> _______________________________________________
>> ncl-talk mailing list
>> List instructions, subscriber options, unsubscribe:
>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20140825/862e66a7/attachment.html
-------------- next part --------------
1970 -7.38
1970 -4.96
1970 -4.97
1970 3.95
1970 -1.46
1970 0.87
1970 2.22
1970 -7.18
1970 -2.90
1970 -6.15
1970 -7.67
1970 -0.77
1970 -0.19
1970 5.80
1970 -0.98
1970 -10.05
1970 -1.58
1970 -8.88
1970 -0.78
1970 12.55
1970 12.70
1970 -3.05
1970 6.83
1970 8.36
1970 3.21
1970 7.02
1970 -10.72
1970 4.71
1970 1.27
1970 1.80
1970 8.38
missing
missing
missing
missing
missing
missing
missing
missing
missing
missing
missing
missing
missing
missing
missing
missing
missing
missing
missing
missing
missing
missing
missing
missing
missing
missing
missing
missing
missing
missing
missing
-------------- next part --------------
A non-text attachment was scrubbed...
Name: eof_j.ncl
Type: application/octet-stream
Size: 9745 bytes
Desc: not available
Url : http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20140825/862e66a7/attachment.obj
-------------- next part --------------
1970 -7.38
1970 -4.96
1970 -4.97
1970 3.95
1970 -1.46
1970 0.87
1970 2.22
1970 -7.18
1970 -2.90
1970 -6.15
1970 -7.67
1970 -0.77
1970 -0.19
1970 5.80
1970 -0.98
1970 -10.05
1970 -1.58
1970 -8.88
1970 -0.78
1970 12.55
1970 12.70
1970 -3.05
1970 6.83
1970 8.36
1970 3.21
1970 7.02
1970 -10.72
1970 4.71
1970 1.27
1970 1.80
1970 8.38
1970 4.56
1970 1.04
1970 -7.50
1970 1.17
1970 -9.08
1970 -1.21
1970 -4.61
1970 1.16
1970 0.30
1970 4.53
1970 -0.13
1970 5.39
1970 -3.97
1970 7.69
1970 2.09
1970 -0.31
1970 -3.64
1970 2.46
1970 1.15
1970 -4.34
1970 -4.74
1970 -4.02
1970 0.29
1970 0.94
1970 -1.69
1970 3.20
1970 -3.11
1970 -1.95
1970 4.70
1970 4.52
1970 5.11
More information about the ncl-talk
mailing list