Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.


Horizontal Navigation Bar


Button Group

Button Hyperlink
titlePrevious
typestandard
urlhttps://confluence.ecmwf.int/display/ECFLOW/Data+acquisition
Button Hyperlink
titleUp
typestandard
urlhttps://confluence.ecmwf.int/display/ECFLOW/Exercises
Button Hyperlink
titleNext
typestandard
urlhttps://confluence.ecmwf.int/display/ECFLOW/Operational+Suite


Here is one possible answer:

import os
import ecflow  
   
defs = ecflow.Defs()
suite = defs.add_suite("data_aquisition")
suite.add_repeat( ecflow.RepeatDay(1) )
suite.add_variable("ECF_HOME",    os.getenv("HOME") + "/course")
suite.add_variable("ECF_INCLUDE", os.getenv("HOME") + "/course")
suite.add_variable("ECF_FILES",   os.getenv("HOME") + "/course/data")
suite.add_variable("SLEEP","2")
for city in ( "Exeter", "Toulouse", "Offenbach", "Washington", "Tokyo", "Melbourne", "Montreal" ) :
    fcity = suite.add_family(city)
    fcity.add_task("archive")
    for obs_type in ( "observations", "fields", "images" ):
        type_fam = fcity.add_family(obs_type)

...


        

...

if city in ("Exeter", "Toulouse", "Offenbach"): type_fam.add_time("00:00 23:00 01:00

...

"

...

)

...


        

...

if city in ("Washington") :                     

...

type_fam.add_time("00:00 23:00 03:00

...

"

...

)

...


        

...

if city in ("Tokyo") :                          

...

type_fam.add_time("12:00")
        

...

if city in ("Melbourne") :                      

...

type_fam.add_day( "monday" )
        

...

if city in ("Montreal") :                       

...

type_fam.add_date(1, 0, 0)
         
        

...

type_fam.add_task("get")
        

...

type_fam.add_task("process").add_trigger("get eq complete")
        

...

type_fam.add_task("store").add_trigger("get eq complete

...

"

...

)

...


        

It is also possible to automatically generate the ecf script using the python API:

defs.generate_scripts()

This enables testing of the suite definition, without worrying about the ecf script‘s.


Note
When there are no event‘s, meter‘s or label‘s in the suite definition, the content of the generated scripts are identical. Hence this functionality should only be used as debug aid for the definition


Horizontal Navigation Bar


Button Group

Button Hyperlink
titlePrevious
typestandard
urlhttps://confluence.ecmwf.int/display/ECFLOW/Data+acquisition
Button Hyperlink
titleUp
typestandard
urlhttps://confluence.ecmwf.int/display/ECFLOW/Exercises
Button Hyperlink
titleNext
typestandard
urlhttps://confluence.ecmwf.int/display/ECFLOW/Operational+Suite

</pre></div> </div> <p>It is also possible to automatically generate the <a class="reference internal" href="/wiki/display/ECFLOW/Glossary#term-ecf-script"><em class="xref std std-term">ecf script</em></a> using the python api:</p> <div class="highlight-python"><div class="highlight"><pre><span class="n">defs</span><span class="o">.</span><span class="n">generate_scripts</span><span class="p">()</span> </pre></div> </div> <p>This enables testing of the <a class="reference internal" href="/wiki/display/ECFLOW/Glossary#term-suite-definition"><em class="xref std std-term">suite definition</em></a>, with out worrying about the <a class="reference internal" href="/wiki/display/ECFLOW/Glossary#term-ecf-script"><em class="xref std std-term">ecf script</em></a>&#8216;s.</p> <div class="admonition note"> <p class="first admonition-title">Note</p> <p class="last">When there are no <a class="reference internal" href="/wiki/display/ECFLOW/Glossary#term-event"><em class="xref std std-term">event</em></a>&#8216;s, <a class="reference internal" href="/wiki/display/ECFLOW/Glossary#term-meter"><em class="xref std std-term">meter</em></a>&#8216;s or <a class="reference internal" href="/wiki/display/ECFLOW/Glossary#term-label"><em class="xref std std-term">label</em></a>&#8216;s in the <a class="reference internal" href="/wiki/display/ECFLOW/Glossary#term-suite-definition"><em class="xref std std-term">suite definition</em></a>, the content of the generated scripts are identical. Hence this functionality should <strong>only</strong> be used as <strong>debug</strong> aid for the definition</p> </div> </div>