Re: reading a lot of variables

From: Adam Phillips <asphilli_at_nyahnyahspammersnyahnyah>
Date: Mon Jan 09 2012 - 12:44:48 MST

Hi Ahmed,
I think you meant to say this:
*var1(i)="EVAPORAT_GDS0_SFC_acc"+i+"h"*

Although I don't see how that would cause your error. Try inserting a
print statement:

*var1=new(18,"string")*
*do i=1,17*
*var1(i)="EVAPORAT_GDS0_SFC_acc"+i+"h"*
*lsp = wrf->$var1(i)$
print("Now done with i = "+i)
*
*end do *
*
*to see if that helps identify where the do loop is crashing.**Hope that
helps.. Adam*
*

On 01/09/2012 12:36 PM, ahmed lasheen wrote:
> Hello
> i have a file grib contains alot of variable which have the following
> names
> EVAPORAT_GDS0_SFC_acc1h ( g0_lat_1, g0_lon_2 )
> EVAPORAT_GDS0_SFC_acc2h ( g0_lat_1, g0_lon_2 )
> EVAPORAT_GDS0_SFC_acc3h ( g0_lat_1, g0_lon_2 )
> EVAPORAT_GDS0_SFC_acc4h ( g0_lat_1, g0_lon_2 )
> EVAPORAT_GDS0_SFC_acc5h ( g0_lat_1, g0_lon_2 )
> EVAPORAT_GDS0_SFC_acc6h ( g0_lat_1, g0_lon_2 )
> EVAPORAT_GDS0_SFC_acc7h ( g0_lat_1, g0_lon_2 )
> EVAPORAT_GDS0_SFC_acc8h ( g0_lat_1, g0_lon_2 )
> EVAPORAT_GDS0_SFC_acc9h ( g0_lat_1, g0_lon_2 )
> EVAPORAT_GDS0_SFC_acc10h ( g0_lat_1, g0_lon_2 )
> EVAPORAT_GDS0_SFC_acc11h ( g0_lat_1, g0_lon_2 )
> EVAPORAT_GDS0_SFC_acc12h ( g0_lat_1, g0_lon_2 )
> EVAPORAT_GDS0_SFC_acc13h ( g0_lat_1, g0_lon_2 )
> EVAPORAT_GDS0_SFC_acc14h ( g0_lat_1, g0_lon_2 )
> EVAPORAT_GDS0_SFC_acc15h ( g0_lat_1, g0_lon_2 )
> EVAPORAT_GDS0_SFC_acc16h ( g0_lat_1, g0_lon_2 )
> EVAPORAT_GDS0_SFC_acc17h ( g0_lat_1, g0_lon_2 )
> EVAPORAT_GDS0_SFC_acc18h ( g0_lat_1, g0_lon_2 )
>
> i wrote ncl code to read it in do loop but i got error
>
> *var1=new(18,"string")*
> *do i=1,17*
> *var1(i)="EVAPORAT_GDS0_SFC_acc1h"+i+"h"*
> *lsp = wrf->$var1(i)$ *
> *end do *
> *
> *
> but i got error ,fatal:Subscript out of range, error in subscript #0
> could anybody told me how can i read all this variable in do loop.
> thanks in advance
>
>
>
>
> --
> ===============
> Ahmed Lasheen
> Junior researcher at Cairo Numerical Weather Prediction Center (CNWPC)
> Egyptian Meteorological Authority(EMA)
> Cairo,Egypt
> ===============
>
>
>
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk

-- 
______________________________________________________________
Adam Phillips                                asphilli@ucar.edu
NCAR/Climate and Global Dynamics Division       (303) 497-1726
P.O. Box 3000				
Boulder, CO 80307-3000    http://www.cgd.ucar.edu/cas/asphilli

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Mon Jan 9 12:44:58 2012

This archive was generated by hypermail 2.1.8 : Wed Jan 18 2012 - 09:21:55 MST