Re: Meridonal Temperature Gradient

From: Mary Haley <haley_at_nyahnyahspammersnyahnyah>
Date: Tue May 03 2011 - 13:59:44 MDT

Hi Soumik,

The error message is indicating that the dimension number you're using in the call to center_finite_diff_n is invalid. You are using index=3, but your input variable is being subscripted such that it is only three dimensions, so the index must be either 0, 1, or 2.

Dimension numbering starts at 0, so if you want the leftmost dimension, use index=0. If you want the second from the left dimension, use index=1, and so on.

I'll take a look at example 6 on the function doc page. Thanks for pointing this out.

--Mary

On May 2, 2011, at 11:58 AM, sbasu@iarc.uaf.edu wrote:

> Hi,
>
> I am trying to use canter_finite _difference_n function to calculate
> meridional temperature gradient.
> But I am getting an error saying
>
> "Invalid dimension index for calculating the center finite difference"
>
> Here is the portion of my script where I am doing this:
>
> nlat = 128
> nlon =256
> dlon = (lon(2)-lon(1))*0.0174533 ; convert to radians
> ; pre-allocate space
> dLon = dble2flt(dlon)
> Lon = dble2flt(lon)
>
> dTdY = new((/124,15,nlat,nlon/),typeof(tempm))
>
> do nl =0,nlon-1 ; loop over each longitude
> dY = 6378388.*cos(0.0174533*Lon(nl))*dLon ; constant at this latitude
> printVarSummary(dY)
> dTdY(:,:,:,nl)= center_finite_diff_n (tempm(:,:,:,nl),dY,True,0,3)
> end do
>
> dtdy = flt2dble(dTdY)
> printVarSummary(dtdy)
> printMinMax(dtdy, True)
> printMinMax(dTdY, True)
>
> Also in the example 6 of documentation of "center_finite_difference_n"
> there are typeo in this line:
>
> dTdX(:,:,nl,:) = center_finite_diff_n (T(:,:,nl;,:), dX , True,0,0)
> it should be I think
> dTdX(:,:,nl,:) = center_finite_diff_n (T(:,:,nl,:), dX , True,0,2)
>
> Thanks,
>
> --
> *************************************
> Soumik Basu
> Graduate Student, Research Assistant
> International Arctic Research Center
> University of Alaska Fairbanks
> Fairbanks,Alaska,USA
> **************************************
>
>
> -----------------------------------------
> This email was sent using SquirrelMail.
> "Webmail for nuts!"
> http://squirrelmail.org/
>
> _______________________________________________
> 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 Tue May 3 13:59:57 2011

This archive was generated by hypermail 2.1.8 : Tue May 03 2011 - 14:47:34 MDT