do loop problem

From: Chao Luo <chao.luo_at_nyahnyahspammersnyahnyah>
Date: Wed Nov 09 2011 - 16:55:45 MST

Hi,

I want to average one parameter in CFSR files. The file name like:
gdas.2010080100.grb2, gads.2010080106.grbs, gads.2010080112.grb, gads.2010080118.grb2
gdas.2010080200.grb2, gads.2010080206.grbs, gads.2010080212.grb, gads.2010080218.grb2
...

The NCL script I wrote as follows, but it dosn't work. Any help is very apprciated!

Thanks much!

Chao

------------------------
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"

begin
   f = addfile ("/data14/cluo/WRFV3.2.1/WRFDATA/CFSR/201008/flxf01.gdas.2010080100.grb2", "r")
 precip = f-> CPRAT_P8_L1_GGA0_avg(:,:)
   avgprecip = precip
   avgprecip(:,:) = 0.

;;;do loop for month files

  do id = 1, 30
  if ( id.lt.10 ) then id = 0 + "id"
  do it = 0, 18, 6
  if (it.lt.10) then it = 0 + "it"
  fname = "id" + "it"
   f = addfile ("/data14/cluo/WRFV3.2.1/WRFDATA/CFSR/201008/flxf01.gdas.201008+"fname","r")
   prcip = f->CPRAT_P8_L1_GGA0_avg(:,:) ; total precipitation
  avgprecip(:,:) = avgprecip(:,:) + precip(:,:)
  end do
  end do
  avgprecip(:,:) = avgprecip(:,:)/30./4.
  end
------------------------
_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Wed Nov 9 16:55:52 2011

This archive was generated by hypermail 2.1.8 : Mon Nov 14 2011 - 10:41:55 MST