Re: fatal:Subscript out of range, error in subscript #0

From: David Brown <dbrown_at_nyahnyahspammersnyahnyah>
Date: Tue Oct 22 2013 - 12:50:14 MDT

Hi Marston,
You are using 'fout' as the variable for both the 2D and the 3D variables. Once the variable is initialized, any attempt to assign different dimensions or sizes will cause an error.
The fix, most likely, is either to call
delete(fout)
at the end of each loop iteration, or (recommended) to use the new 'reassignment' operator ':=', e.g.:

fout : = Pro2D(f,fout,Sname(n),name(n),itime,LAT1x1,LON1x1,LAT2x2,LON2x2,n)

and later

fout := Pro3D(f,fout,Sname(n),name(n),itime,level,f->lev_2(level),LAT1x1,LON1x1,LAT2x2,LON2x2,n)

 -dave

On Oct 22, 2013, at 12:09 PM, Marston Johnston <shejo284@gmail.com> wrote:

> Hi all,
>
> I know this error: fatal:Subscript out of range, error in subscript #0, seems like a simple enough error message to understand but I cannot seem to find the cause of the problem. I'm writing data to a file and after some variables are written, I read the data from the newly written file and create a new variable, then I write the new variable to the outfile. It is when I write this new variable that I get this error which frankly boggles my mind. The error occurs on the 2nd time step. I would love some assistance in understanding and solving this error.
>
> I have attached the script and below is a copy of the output for two time steps:
>
> %@a7 ncl_codes]$ ncl echam_regrid.ncl
> Copyright (C) 1995-2013 - All Rights Reserved
> University Corporation for Atmospheric Research
> NCAR Command Language Version 6.1.2
> The use of this software is governed by a License Agreement.
> See http://www.ncl.ucar.edu/ for more details.
> (0) Names in nc file: var26
> (1) Names in nc file: var142
> (2) Names in nc file: var143
> (3) Names in nc file: var178
> (4) Names in nc file: var179
> (5) Names in nc file: var184
> (6) Names in nc file: var245
> (7) Names in nc file: var246
> (8) Names in nc file: var247
> (9) Names in nc file: var248
> (10) Names in nc file: var249
> (11) Names in nc file: var251
> (12) Names in nc file: var252
> (13) Names in nc file: var253
> (14) Names in nc file: var21
> (15) Names in nc file: var22
> (16) Names in nc file: var23
> (17) Names in nc file: var24
> (18) Names in nc file: var25
> (19) Names in nc file: var223
> (20) Names in nc file: var243
> (21) Names in nc file: var244
> (0) Create a large file to hold the data
> (0) Regridding the variables...
> (0) Processing time step: 0
> (0) Processing variable:-> var26 mapping to:->SP
> (0) Processing variable:-> var142 mapping to:->LSP
> (0) Processing variable:-> var143 mapping to:->CP
> (0) Processing variable:-> var178 mapping to:->TSIR
> (0) Processing variable:-> var179 mapping to:->TTR
> (0) Processing variable:-> var184 mapping to:->SI
> (0) Processing variable:-> var245 mapping to:->sunlit_ISCCP
> (0) Processing variable:-> var246 mapping to:->TCC_ISCCP
> (0) Processing variable:-> var247 mapping to:->CTP_ISCCP
> (0) Processing variable:-> var248 mapping to:->CALB_ISCCP
> (0) Processing variable:-> var249 mapping to:->TAU_ISCCP
> (0) Processing variable:-> var251 mapping to:->DCFLAG
> (0) Processing variable:-> var252 mapping to:->SCFLAG
> (0) Processing variable:-> var253 mapping to:->MCFLAG
> (0) Calculate the ALBEDO...
> (0) Processing variable:-> var21 mapping to:->R
> (0) Processing variable:-> var22 mapping to:->Q
> (0) Processing variable:-> var23 mapping to:->CLWC
> (0) Processing variable:-> var24 mapping to:->CIWC
> (0) Processing variable:-> var25 mapping to:->T
>
> (0) Processing variable:-> var223 mapping to:->CC
> (0) Processing variable:-> var243 mapping to:->CC_ISCCP_3D
> (0) Processing variable:-> var244 mapping to:->TAU_ISCCP_3D
> (0) Processing time step: 1
> (0) Processing variable:-> var26 mapping to:->SP
> (0) Processing variable:-> var142 mapping to:->LSP
> (0) Processing variable:-> var143 mapping to:->CP
> (0) Processing variable:-> var178 mapping to:->TSIR
> (0) Processing variable:-> var179 mapping to:->TTR
> (0) Processing variable:-> var184 mapping to:->SI
> (0) Processing variable:-> var245 mapping to:->sunlit_ISCCP
> (0) Processing variable:-> var246 mapping to:->TCC_ISCCP
> (0) Processing variable:-> var247 mapping to:->CTP_ISCCP
> (0) Processing variable:-> var248 mapping to:->CALB_ISCCP
> (0) Processing variable:-> var249 mapping to:->TAU_ISCCP
> (0) Processing variable:-> var251 mapping to:->DCFLAG
> (0) Processing variable:-> var252 mapping to:->SCFLAG
> (0) Processing variable:-> var253 mapping to:->MCFLAG
> fatal:Subscript out of range, error in subscript #0
> fatal:Subscript out of range, error in subscript #0
> fatal:Subscript out of range, error in subscript #0
> fatal:Subscript out of range, error in subscript #0
> fatal:Subscript out of range, error in subscript #0
> fatal:Subscript out of range, error in subscript #0
>
> The input file is very large but if you have room on the NCL server I could upload it.
>
> Thanks in advance,
> /Marston
> <echam_regrid.ncl>_______________________________________________
> 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 Tue Oct 22 12:50:33 2013

This archive was generated by hypermail 2.1.8 : Fri Nov 01 2013 - 08:58:14 MDT