[ncl-talk] daily average

Dennis Shea shea at ucar.edu
Fri May 6 06:54:32 MDT 2016


Guido's comment about a space between 'end' and 'do ' is correct.
Further, you can not change the do loop index values within the do loop.
There are other errors.

It is best to use print statements to follow the execution of your code.

A code segment that should worl is:

  Tpj=new((/31,37,73,144/),float)
  tStrt = 0
  tLast = 3
  do j=0,30
     print("jday="+(j+1))
     Tpj(j,:,:,:)=dim_avg_n(T(tStrt:tLast,:,:,:),0)
     tStrt = tStrt+4
     tLast = tLast+4
  end do



--
If you are new to NCL *please* read the documentation.

http://www.ncl.ucar.edu/Document/Manuals/

  Mini-Reference Manual

A pair of tutorials created by *Karin Meier-Fleischer* and *Michael
Böttinger* of DKRZ <https://www.dkrz.de/> (Deutsches Klimarechenzentrum)
are also available.

====






On Fri, May 6, 2016 at 1:59 AM, Guido Cioni <guidocioni at gmail.com> wrote:

> Hi,
> as stated in the guide (
> http://www.ncl.ucar.edu/Document/Language/loops.shtml) *Note: there is a
> space between the "end" and the "do" in NCL:* *(end do)*!
> Check your script.
>
> Guido Cioni
> http://guidocioni.altervista.org
>
> On 06 May 2016, at 09:57, WIND <954051157 at qq.com> wrote:
>
> Dear all,
> I'm dealing with the JRA four times per day grib data. And I want to
> average the four times data to get a daily data.
> My script is listed below
> *load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"*
> *load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"*
> *load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"*
> *fa=addfile("t.grib","r")*
> *T=fa->TMP_GDSO_ISBL ;T(123,37,73,144) *
> *Tpj=new((/31,37,73,144/),float)*
> *do j=0,30 *
> *    do i=0,123 *
> *
> Tpj(j,:,:,:)=(T(i,:,:,:)+T(i+1,:,:,:)+T(i+2,:,:,:)+T(i+3,:,:,:))/4*
> *    i=i+4*
> *   j=j+1*
> *   enddo;*
> *enddo;*
>  the error goes synatx error and error in statement. How should I do to
> get the daily average?
> Any help would be appreciated!
> Sincerely,
> Yan
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at ucar.edu
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
>
>
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at ucar.edu
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20160506/c918916f/attachment.html 


More information about the ncl-talk mailing list