Re: MJO - error in subscript

From: Heavenly Avenger - NCL <avenger-ncl_at_nyahnyahspammersnyahnyah>
Date: Wed Aug 14 2013 - 14:51:27 MDT

(...)
monInfo = new ((/12,2/),"string")
monInfo(nMon,0) = namMonth(imon(0)-1)
(...)
if (iday(nt).eq.1) then
    nMon = nMon+1
    print("will select monInfo("+nMon+",0).")
    monInfo(nMon,0) = namMonth(imon(nt)-1)
(...)

output:
(0) will select monInfo(1,0).
(0) will select monInfo(2,0).
(0) will select monInfo(3,0).
(0) will select monInfo(4,0).
(0) will select monInfo(5,0).
(0) will select monInfo(6,0).
(0) will select monInfo(7,0).
(0) will select monInfo(8,0).
(0) will select monInfo(9,0).
(0) will select monInfo(10,0).
(0) will select monInfo(11,0).
(0) will select monInfo(12,0).

You allocated monInfo(0:11,0:1) and is using monInfo(0:12,0:1) (considering the monInfo(nMon,0) at line 94).

- fabricio

From: Guilherme Martins
Sent: Tuesday, August 13, 2013 8:16 PM
To: mgehne@ucar.edu
Cc: NCL
Subject: Re: MJO - error in subscript

Don't work!

If nMon=-1 ==> error here monInfo(nMon,0) = namMonth(imon(0)-1) ==> line 94

I can't understand here:

      if (iday(nt).eq.1) then
          nMon = nMon+1 ==> I have change the position. You told me to put just before the "end if"
          monInfo(nMon,0) = namMonth(imon(nt)-1)
          monInfo(nMon,1) = colMonth(imon(nt)-1)
      end if

Thanks,

Guilherme

2013/8/13 <mgehne@ucar.edu>

  Hi Guilherme,

  either put nMon = nMon+1 just before the "end if" command in your loop or
  initialize with nMon = -1.
  That should make nMon go from 0 to 11 instead of 1 to 12.

  Maria

> Sorry Rick, but I can't understand. What do I need to do?
>
> if (iday(nt).eq.1) then
> nMon = nMon+1
> monInfo(nMon,0) = namMonth(imon(nt)-1)
> monInfo(nMon,1) = colMonth(imon(nt)-1)
> end if
>
> Where is the error, I can't see.
>
> Thanks,
>
> Guilherme.
>
>
> 2013/8/13 Rick Brownrigg <brownrig@ucar.edu>
>
>> Line 125 is actually the line:
>>
>> monInfo(nMon,0) = namMonth(imon(nt)-1)
>>
>> and a few print statements to show nt, imon(nt) and nMon reveal that
>> nMon
>> ranges from 1-12, and at 12, it exceeds the bounds of monInfo (which is
>> 12x2)
>>
>> HTH -- Rick
>>
>> On Aug 13, 2013, at 3:20 PM, Guilherme Martins <jgmsantos@gmail.com>
>> wrote:
>>
>> Hi all,
>>
>> I'm run the script "mjoclivar_15.ncl". but I receive the error:
>>
>> fatal:Subscript out of range, error in subscript #0
>> fatal:["Execute.c":8128]:Execute: Error occurred at or near line 125 in
>> file mjoclivar_15.ncl
>>
>> I saw the line 125, and the problem I saw is in "nMon = nMon+1"
>>
>> because finish in 11 and not 12.
>>
>> The files are in attach.
>>
>> Thanks,
>>
>> Guilherme.
>>
>> --

>> *Guilherme Martins*

>> https://sites.google.com/site/jgmsantos/
>>
>> <mjoclivar_15.ncl><MJO_PC_INDEX.novo.nc>
>> _______________________________________________
>> ncl-talk mailing list
>> List instructions, subscriber options, unsubscribe:
>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>
>>
>>
>
>
> --

> *Guilherme Martins*
> https://sites.google.com/site/jgmsantos/

> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>

-- 
Guilherme Martins 
https://sites.google.com/site/jgmsantos/
--------------------------------------------------------------------------------
_______________________________________________
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 Wed Aug 14 14:53:59 2013

This archive was generated by hypermail 2.1.8 : Wed Aug 14 2013 - 18:35:09 MDT