[Thread Prev][Thread Next][Index]

[ferret_users] Re: IF-ELIF-ELSE-ENDIF in a repeat loop



Thanks a lot for everyone who has replied.

It was due to a typo in the script.

My apology!

--- Peng

On Wed, Mar 28, 2018 at 11:40 AM, Ge Peng - NOAA Affiliate <ge.peng@xxxxxxxx> wrote:
Hi, 

I have the following script within a repeat loop:

IF  `ng_r_nz GE 1` THEN ;\

    let wk_new=IF sie_wk THEN  sie_wk ELSE (`nz_spvl`)  ;\   

ELIF `ng_r_zo GE 1` TEHN ;\

    let wk_new=IF sie_wk THEN  sie_wk ELSE (`zo_spvl`)  ;\

ELSE ;\

    let wk_new=IF sie_wk THEN  sie_wk ELSE (`ms_spvl`)  ;\

ENDIF ;\


I would like to set the missing data value to
       ->  nz_spvl if ng_r_nz >= 1
       ->  zo_spvl if ng_r_nz <1 but  ng_r_zo >= 1   
       ->  ms_spvl otherwise (i.e., ng_r_nz <1 and  ng_r_zo < 1

​ng_r_* are either 0 or positive integers; sie_wk are real values on an irregular, 2-dimensional grid.​

​However, ​I am getting the following error message:

**ERROR: command syntax: Entire ELIF statement should be "ELIF expr THEN"

          ELIF 0 TEHN



What did I do wrong? 


The following link: http://ferret.pmel.noaa.gov/Ferret/documentation/users-guide/commands-reference/IF

provides the following example:


IF `i LT 3` THEN
GO option_1
ELIF `i LT 6` THEN
GO option_2
ELSE
GO option_3
ENDIF

Thanks,


--- Peng


--

Ge Peng, PhD
Research Scholar
Cooperative Institute for Climate and Satellites - NC (CICS-NC)/NCSU at

NOAA’s National Centers for Environmental Information (NCEI)

Center for Weather and Climate (CWC)

151 Patton Ave, Asheville, NC 28801
+1 828 257 3009; ge.peng@xxxxxxxx

ORCID: http://orcid.org/0000-0002-1986-9115

Following CICS-NC on Facebook






--

Ge Peng, PhD
Research Scholar
Cooperative Institute for Climate and Satellites - NC (CICS-NC)/NCSU at

NOAA’s National Centers for Environmental Information (NCEI)

Center for Weather and Climate (CWC)

151 Patton Ave, Asheville, NC 28801
+1 828 257 3009; ge.peng@xxxxxxxx

ORCID: http://orcid.org/0000-0002-1986-9115

Following CICS-NC on Facebook




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

Privacy Policy | Disclaimer | Accessibility Statement