Re: opening the files

From: Michael Notaro <mnotaro_at_nyahnyahspammersnyahnyah>
Date: Wed Mar 27 2013 - 16:06:07 MDT

Something like this should work.

do iy=1979,2010
 do im=0,11

 if (im.le.8) then
 month="0"+(im+1)
 else
 month=""+(im+1)
 end if

 a=addfile("era.cice.h."+iy+"-"+month+".nc","r")

 end do
end do

On 03/27/13, Alexander Semenov wrote:
> Hi,
>
> I have a question.
>
>
> I am reading a bunch of files like this
>
>
> year = 1979
> month = 01
>
> files = systemfunc("ls era.cice.h."+year+"-"+month+".nc")
>
>
> With that notion I believe ncl will loop through the files, but the program crashes because month in the output file has 2 digits and not 1. So, when the code reads the data it reads: era.cice.h.1979-1.nc(http://era.cice.h.1979-1.nc) which is incorrect, it needs to be era.cice.h.1979-01.nc(http://era.cice.h.1979-01.nc)
>
>
> I tried to fix it with the if statement but I got confused with syntaxis. Could you help me please with this?
>
>
> Thanks,
> Alex
_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Wed Mar 27 16:06:23 2013

This archive was generated by hypermail 2.1.8 : Tue Apr 02 2013 - 21:23:48 MDT