[Thread Prev][Thread Next][Index]

Re: [ferret_users] format number and text with LIST/FORMAT



If you loop through time there is no problem:

use monthly_navy_winds.cdf
let VAR1 = UWND[I=23,J=73]
!--- first 3 time steps. If all replace "3" by `var1, return=LEND`
repeat/l=1:3 ( list/nohead/format=("`TAX_DATESTRING(T[GT=VAR1],VAR1,
"month")` ", F10.3) VAR1 )

Output:
yes? repeat/l=1:3
( list/nohead/format=("`TAX_DATESTRING(T[GT=VAR1],VAR1, "month")` ",
F10.3) VAR1 )
!-> REPEAT: L=1
 !-> list/nohead/format=("JAN-1982 ", F10.3) VAR1
JAN-1982     -3.969
!-> REPEAT: L=2
 !-> list/nohead/format=("FEB-1982 ", F10.3) VAR1
FEB-1982     -4.578
!-> REPEAT: L=3
 !-> list/nohead/format=("MAR-1982 ", F10.3) VAR1
MAR-1982      1.593

Paulo
-----------------------
On Mon, 2010-07-19 at 16:53 +0200, James Orr wrote:
> Hi Patrick,
> 
> Unlike fortran, I don't think the /FORMAT option in Ferret works 
> correctly for the A field specifier (for character strings).  But 
> there is a convoluted work-around using the REPEAT function:
> 
>   use monthly_navy_winds.cdf
>   let VAR1 = UWND[I=23,J=73]
>   let v1end = `var1, return=LEND`
>   set list/file=test.txt ; sp rm test.txt
>   repeat/range=1:`v1end`:1/name=s  (                             ; \
>     def sym alpha TAX_DATESTRING(T[GT=VAR1,l=`s`],VAR1, "month") ; \
>     list/nohead/file/append/format=("`($alpha)`", F10.3) VAR1      )
> 
> The previous proposed solution does not work because you want to work 
> with a character array.
> 
> Cheers,
> 
> Jim
> 
> 
> On Mon, 19 Jul 2010, Paulo B. Oliveira wrote:
> 
> > Hi Patrick,
> >
> > I guess you can use:
> >
> > list/nohead/format=("`TAX_DATESTRING(T[GT=VAR],VAR1,
> >> "month")` ", F10.3) VAR1
> >
> > Paulo
> > --------------------------
> > On Mon, 2010-07-19 at 12:21 +0200, Brockmann Patrick wrote:
> >> Hi all,
> >>
> >> Is there a way to format numbers and text together
> >> when the list command and the format FORTRAN qualifier are used ?
> >>
> >> Here is an example and the error
> >>
> >> yes? use monthly_navy_winds.cdf
> >> yes? let VAR1 = UWND[I=23,J=73]
> >> yes? list/nohead/format=(A30,' ',F10.3) TAX_DATESTRING(T[GT=VAR],VAR1,
> >> "month"), VAR1
> >>  **ERROR: invalid command: format disallowed for multiple variables w/
> >> strings
> >>
> >> Patrick
> >
> >
> 



[Thread Prev][Thread Next][Index]

Contact Us
Dept of Commerce / NOAA / OAR / PMEL / TMAP

Privacy Policy | Disclaimer | Accessibility Statement