Re: Handling Multiple File

From: Adam Phillips <asphilli_at_nyahnyahspammersnyahnyah>
Date: Sat May 29 2010 - 10:23:42 MDT

Hello,
First, instead of all of those if statements, you can use sprinti:
mm = sprinti("%2.2i",m)

Second, are you deleting the t array at the end of the do loop? I am not
sure whether the error message is occurring at the addfiles line or the t
= infile1[:]-> line... If deleting t at the end of the do loop does not
fix the problem, please write ncl-talk back and let us know..
Hope that helps..
Adam

> Hello,
>
> I am a beginner in ncl. I tried to analyse data set of 100 year output
> from
> a model. I have one file for each month.
>
> begin
>
> do m = 1,12,1
> if(m.eq.1)then mm="01"
> end if
> if (m.eq.2) then mm="02"
> end if
> if (m.eq.3) then mm="03"
> end if
> if(m.eq.4)then mm="04"
> end if
> if (m.eq.5) then mm="05"
> end if
> if (m.eq.6) then mm="06"
> end if
> if(m.eq.7)then mm="07"
> end if
> if (m.eq.8) then mm="08"
> end if
> if (m.eq.9) then mm="09"
> end if
> if(m.eq.10)then mm="10"
> end if
> if (m.eq.11) then mm="11"
> end if
> if(m.eq.12)then mm="12"
> end if
> print("mm="+mm)
> fpath = systemfunc ("ls /gpfs2/home/kiran/freerun/t62/monthly/time_mean.*"
> +
> mm
> + ".nc")
>
> infile1= addfiles(fpath,"r")
> t=infile1[:]->temp(:,0,:,:)
> ............................................
> ............................................
> ...........................................
> delete (fpath)
> delete (infile1)
> end do
> end
> #######################
> The output is obtained for the first run of the loop. But the second flow
> through the loop end up with an error message. The error message is as
> follows.
> ________________________________________
> Copyright (C) 1995-2009 - All Rights Reserved
> University Corporation for Atmospheric Research
> NCAR Command Language Version 5.1.1
> The use of this software is governed by a License Agreement.
> See http://www.ncl.ucar.edu/ for more details.
> (0) mm=01
> (0) mm=02
> *fatal:Dimension sizes of left hand side and right hand side of assignment
> do not match
> fatal:Execute: Error occurred at or near line 32 in file clim7.ncl*
> _________________________________________
> The line 32 is the position where there is opening of data files.
> I have tried the code with and without the delete() statement at the end
> of
> the loop.
> On both cases the error message is same.
>
> Can anybody suggest a way to solve the problem?
>
> Thanking you in Advance
>
> <http://sites.google.com/site/gibiesge/>Gibies George,CSIR-RF,
> Climate and Global Modelling Division,
> Indian Institute of Tropical Meteorology,
> Dr. Homi Bhabha Road,
> NCL (P. O.), Pashan,
> Pune 411008, India.
>
> http://sites.google.com/site/gibiesge/
> _______________________________________________
> 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 Sat May 29 10:23:47 2010

This archive was generated by hypermail 2.1.8 : Tue Jun 01 2010 - 09:12:20 MDT