Skip to content

Commit

Permalink
draft on obs
Browse files Browse the repository at this point in the history
  • Loading branch information
floriankrb committed Aug 21, 2024
1 parent 9cebff5 commit 78b78bd
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
2 changes: 1 addition & 1 deletion obs/config.yaml → dev/obs/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ observations: # for now "observations" must be on top level, will be removed
is_observations: true # will desappear
- dataset: aifs-ea-an-oper-0001-mars-o96-1979-2022-6h-v6
start: 2004-11-09 00:00:00
end: 2023-12-31 00:00:00
end: 2023-12-31 00:00:00
File renamed without changes.
15 changes: 9 additions & 6 deletions obs/demo.py → dev/obs/demo.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#!/usr/bin/env python3
import sys

from anemoi.datasets import open_dataset


def str_(t):
""" Not needed, but useful for debugging """
"""Not needed, but useful for debugging"""
import numpy as np

if isinstance(t, (list, tuple)):
Expand All @@ -15,6 +15,7 @@ def str_(t):
return "{" + " , ".join(f"{k}: {str_(v)}" for k, v in t.items()) + "}"
return str(t)


def main(path, filter):
with open(path, "r") as f:
import yaml
Expand Down Expand Up @@ -43,11 +44,13 @@ def main(path, filter):
data = ds[i]
print(f"✅Got item {i} for time window ending {date}: {str_(data)}")

if __name__ == '__main__':

if __name__ == "__main__":
import argparse

parser = argparse.ArgumentParser()
parser.add_argument('--config', help='Path to config file', default='config.yaml')
parser.add_argument('--filter', help='filter dates (ex: 2017 or 2017-11)', default='2017-11-11')
parser.add_argument("--config", help="Path to config file", default="config.yaml")
parser.add_argument("--filter", help="filter dates (ex: 2017 or 2017-11)", default="2017-11-11")
args = parser.parse_args()

main(args.config, args.filter)
main(args.config, args.filter)

0 comments on commit 78b78bd

Please sign in to comment.