[Thread Prev][Thread Next][Index]

Re: [ferret_users] variable unknown or not in data set: BAD



Hi Ansley,
thank you for your help!

Do you have a clue why is it giving BAD value when I list through defining a new variable (DKBDI) and a REAL number when I list it out?
I did the iteration until L=8 now, and here you can see that DSLR[L=8] is GT 0, thus it must give DKBDI a valid value if ((KBDIX-800)*(-1)*(.968*EXP(.0486*(TEMPY*9/5+32))-8.3)*.001/(1+10.88*EXP(-.0441*ANNRF/25.4))*.254) is giving one.
My goal is continuing the iteration and not stopping the loop gracefully.

Peter

yes? list DSLR[L=8]
             VARIABLE : MISSING(CROSS[L=@CDB:1]/24,0)
             LONGITUDE: 19E
             LATITUDE : 47N
             Z (m)    : 42752
             TIME     : 08-JAN-1961 12:00 NOLEAP
          1.000
yes? list ((KBDIX-800)*(-1)*(.968*EXP(.0486*(TEMPY*9/5+32))-8.3)*.001/(1+10.88*EXP(-.0441*ANNRF/25.4))*.254)
 *** NOTE: Ambiguous coordinates on X axis: ((KBDIX-800)*(-1)*(.968*EXP(.0486*(TEMPY*9/5+32))-8.3)*.001/(1+10.88*EXP(-.0441*ANNRF/25.4))*.254)
             VARIABLE : ((KBDIX-800)*(-1)*(.968*EXP(.0486*(TEMPY*9/5+32))-8.3)*.001/(1+10.88*EXP(-.0441*ANNRF/25.4))*.254)
             LONGITUDE: 19.1E(19.1)
             LATITUDE : 47N
             Z (m)    : 47362
             TIME     : 07-JAN-1961 18:00
         -0.01597
yes? list dkbdi
             VARIABLE : IF (DSLR[L=8] GT 0) THEN ((KBDIX-800)*(-1)*(.968*EXP(.0486*(TEMPY*9/5+32))-8.3)*.001/(1+10.88*EXP(-.0441*ANNRF/25.4))*.254) ELSE DKBDI_5
             LONGITUDE: 19E
             LATITUDE : 47N
             Z (m)    : 42752
             TIME     : 08-JAN-1961 12:00 NOLEAP
        ....



On Mon, Aug 18, 2014 at 7:14 PM, Ansley Manke <ansley.b.manke@xxxxxxxx> wrote:
Hi Peter,
When you evaluate an _expression_ with grave-accents, the grave accents are evaluated as the command is parsed, filling in the value to make a new command, so that

   let kbdix=`kbdi`   becomes  DEFINE VARIABLE kbdix=-9.696305

When the _expression_ in grave accents missing-value flag, it's replaced by the string BAD, so the result is

   DEFINE VARIABLE kbdix=BAD

Then the Ferret parser sees that command and says, well BAD is not any defined variable name, and that's the error message you're getting.

At the end of REPEAT: L=7, you list dslr,lr,dkbdi_5,dkbdi,kbdi, with the results:


I / *:     1.000  0.0000  0.0000  .... ....

because the variable kbdi evaluates to a bad-value, the "let kbdix=`kbdi`" command in the next iteration results in "let kbdix=bad".  The loop can't continue.

You could do a "if `kbdi` then 1 else EXIT/LOOP" to gracefully exit out of the loop if you wish, or to reset kbdi to some desired value and continue.

Ansley


On 8/18/2014 5:35 AM, Peter Szabo wrote:
Dear Users,

I would like to find out what causes this error (during calculating Keetch-Byram index), also, how to fix this simple calculation.

The error message is BAD variable definition. Repetition until L=7 works fine, when an important variable becomes negative (-9), it defines during a calculation a BAD variable (the changing basic variable), and the next iteration stops.
When I removed the quotes(let kbdix=`kbdi`), naturally came stack overflow.
Here is what I used, and the bottom lines are the results of the script.

Thanks for you help and enjoy August wherever you are,

Peter Szabo
-------

yes? let kbdi=0
yes? repeat/l=2:365 (let kbdix=`kbdi`; let tempy=var15[d=2,l=`l-1`,k=1]-273.15; let lr=if var202[d=1,l=`l`,k=1] lt 0.05 then 0 else var202[d=1,l=`l`,k=1]; let dkbdi_5=if (dslr[l=`l`] eq 0) and (lr[l=`l`] ge 5) then (-1*lr[l=`l`]+5) else 0; let dkbdi=if (dslr[l=`l`] gt 0) then ((kbdix-800)*(-1)*(.968*Exp(.0486*(tempy*9/5+32))-8.3)*.001/(1+10.88*Exp(-.0441*annrf/25.4))*.254) else dkbdi_5; let kbdi=kbdix+dkbdi; list/nohead dslr,lr,dkbdi_5,dkbdi,kbdi)
---

!-> REPEAT: L=7
 !-> DEFINE VARIABLE kbdix=0
 !-> DEFINE VARIABLE tempy=var15[d=2,l=6,k=1]-273.15
 !-> DEFINE VARIABLE lr=if var202[d=1,l=7,k=1] lt 0.05 then 0 else var202[d=1,l=7,k=1]
 !-> DEFINE VARIABLE dkbdi_5=if (dslr[l=7] eq 0) and (lr[l=7] ge 5) then (-1*lr[l=7]+5) else 0
 !-> DEFINE VARIABLE dkbdi=if (dslr[l=7] gt 0) then ((kbdix-800)*(-1)*(.968*Exp(.0486*(tempy*9/5+32))-8.3)*.001/(1+10.88*Exp(-.0441*annrf/25.4))*.254) else dkbdi_5

I / *:     0.0000  14.70  -9.696 -9.696 -9.696

!-> REPEAT: L=8
 !-> DEFINE VARIABLE kbdix=-9.696305
 !-> DEFINE VARIABLE tempy=var15[d=2,l=7,k=1]-273.15
 !-> DEFINE VARIABLE lr=if var202[d=1,l=8,k=1] lt 0.05 then 0 else var202[d=1,l=8,k=1]
 !-> DEFINE VARIABLE dkbdi_5=if (dslr[l=8] eq 0) and (lr[l=8] ge 5) then (-1*lr[l=8]+5) else 0
 !-> DEFINE VARIABLE dkbdi=if (dslr[l=8] gt 0) then ((kbdix-800)*(-1)*(.968*Exp(.0486*(tempy*9/5+32))-8.3)*.001/(1+10.88*Exp(-.0441*annrf/25.4))*.254) else dkbdi_5

I / *:     1.000  0.0000  0.0000  .... ....

!-> REPEAT: L=9
 !-> DEFINE VARIABLE kbdix=bad
 !-> DEFINE VARIABLE tempy=var15[d=2,l=8,k=1]-273.15
 !-> DEFINE VARIABLE lr=if var202[d=1,l=9,k=1] lt 0.05 then 0 else var202[d=1,l=9,k=1]
 !-> DEFINE VARIABLE dkbdi_5=if (dslr[l=9] eq 0) and (lr[l=9] ge 5) then (-1*lr[l=9]+5) else 0
 !-> DEFINE VARIABLE dkbdi=if (dslr[l=9] gt 0) then ((kbdix-800)*(-1)*(.968*Exp(.0486*(tempy*9/5+32))-8.3)*.001/(1+10.88*Exp(-.0441*annrf/25.4))*.254) else dkbdi_5

 **ERROR: variable unknown or not in data set: BAD
list/nohead dslr,lr,dkbdi_5,dkbdi,kbdi
Command file, command group, or REPEAT execution aborted




[Thread Prev][Thread Next][Index]
Contact Us
Dept of Commerce / NOAA / OAR / PMEL / Ferret

Privacy Policy | Disclaimer | Accessibility Statement