[Thread Prev][Thread Next][Index]

Re: [ferret_users] problem about giving value to array



Hi Lin,
The syntax

let uave[l='l']=

is not valid in Ferret. The left-hand side of a definition is always a simple variable name. Ferret is designed so that the context and the variable definitions include all of the grid information and operations, and the commands operate on entire grids or regions at once. The use of a varying limit for the @AVE transformation is somewhat outside of this standard Ferret framework.

You can do your computation one time step at a time, as you have in your second set of commands. You could save those results to a file, either an ASCII listing with LIST/APPEND or a netCDF file with the SAVE/APPEND command, and then read that file to use those results. If you do this, you'll want to cancel the original dataset and cancel the previous variable definitions before using the new file.

You could also write an external function to do this, sending it the data fields and the time-varying ZH variable and writing code to do the averaging, with the result being the averaged field as a function of time.

Ansley

Lin Mu wrote:

dear users
Now I have problems.I want to calculate every time step upper layer average density and lower layer average density on one point. zh(199) is a depth variable which is changing with time.

repeat/l=1:199 (let uave=denano[z=0:zh[l=`l`]@ave];let lave=denano[z=zh[l=`l`]:700@ave])
list uave
**ERROR: command syntax: ZH[L=199]
this command is ineffective

repeat/l=1:199 (let zhh=zh[l=`l`];let uave=denano[z=0:`zhh`@ave];let lave=denano[z=`zhh`:700@ave])
list uave
this is ok ,why?

another problem I want uave is a array(199) which can store value in every time step,the dimension is 199.How can I in the repeat command give the value to uave[l='l']
repeat/l=1:199 (let zhh=zh[l=`l`];
let uave[l='l']=denano[z=0:`zhh`@ave,l=`l`];
let lave[l=`l`]=denano[z=`zhh`:700@ave,l=`l`])

!-> REPEAT: L=1
!-> DEFINE VARIABLE zhh=zh[l=1]
*** NOTE: Ambiguous coordinates on T axis: RHO_UN(SAO,THO[D=1],0.)
!-> DEFINE VARIABLE uave[l='l']=denano[z=0:161.92@ave]
**ERROR: command syntax: illegal name: UAVE[L
DEFINE VARIABLE uave[l='l']=denano[z=0:161.92@ave]

this is not ok.why?

thank you very much .



[Thread Prev][Thread Next][Index]

Dept of Commerce / NOAA / OAR / PMEL / TMAP

Contact Us | Privacy Policy | Disclaimer | Accessibility Statement