File: test_mars.py

package info (click to toggle)
ecmwf-api-client 1.6.5-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 136 kB
  • sloc: python: 572; makefile: 4
file content (26 lines) | stat: -rwxr-xr-x 535 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#!/usr/bin/env python3
import ecmwfapi
import time
import os


def test_mars():
    while True:
        try:
            c = ecmwfapi.ECMWFService("mars")
            c.execute({"date": "2000-01-01"}, "mars.grib")
            assert os.path.getsize("mars.grib") == 1238868

            return
        except ecmwfapi.api.APIException as e:
            print(e)
            msg = str(e)
            if "USER_QUEUED_LIMIT_EXCEEDED" not in msg:
                raise

        time.sleep(120)



if __name__ == "__main__":
    test_mars()