Fix update script a bit

This commit is contained in:
Tom Hodson 2025-05-23 16:45:37 +00:00
parent ba2c67d812
commit 3328a0375b
3 changed files with 27 additions and 10 deletions

View File

@ -0,0 +1,6 @@
---
type: remote
host: databridge-prod-catalogue3-ope.ewctest.link
port: 10000
engine: remote
store: remote

View File

@ -0,0 +1,6 @@
---
type: remote
host: databridge-prod-catalogue1-ope.ewctest.link
port: 10000
engine: remote
store: remote

View File

@ -13,30 +13,35 @@ from time import time
import psutil import psutil
from qubed import Qube from qubed import Qube
from tqdm import tqdm from tqdm import tqdm
import requests
process = psutil.Process() process = psutil.Process()
CHUNK_SIZE = timedelta(days=60) CHUNK_SIZE = timedelta(days=60)
FILEPATH = "./full_dt_qube.json" FILEPATH = "tests/example_qubes/full_dt.json"
API = "https://qubed.lumi.apps.dte.destination-earth.eu/api/v1" API = "https://qubed.lumi.apps.dte.destination-earth.eu/api/v1"
with open("config/api.secret", "r") as f:
secret = f.read()
def ecmwf_date(d): def ecmwf_date(d):
return d.strftime("%Y%m%d") return d.strftime("%Y%m%d")
# start_date = datetime.now() - timedelta(days=10) start_date = datetime.now() - timedelta(days=120)
start_date = datetime(1990, 1, 1) # start_date = datetime(1990, 1, 1)
# end_date = datetime.now() # end_date = datetime.now()
end_date = datetime(2026, 1, 1) end_date = datetime(2026, 1, 1)
current_span = [end_date - CHUNK_SIZE, end_date] current_span = [end_date - CHUNK_SIZE, end_date]
try:
qube = Qube.load(FILEPATH) qube = Qube.load(FILEPATH)
# qube = Qube.empty() except:
qube = Qube.empty()
while current_span[0] > start_date: while current_span[0] > start_date:
for config in ["config-climate-dt.yaml", "config-extremes-dt.yaml"]: for config in ["config/config-climate-dt.yaml", "config/config-extremes-dt.yaml"]:
t0 = time() t0 = time()
start, end = map(ecmwf_date, current_span) start, end = map(ecmwf_date, current_span)
print(f"Doing {config} {current_span[0].date()} - {current_span[1].date()}") print(f"Doing {config} {current_span[0].date()} - {current_span[1].date()}")
@ -81,10 +86,10 @@ while current_span[0] > start_date:
subqube.print(depth=2) subqube.print(depth=2)
print(f"{subqube.n_nodes = }, {subqube.n_leaves = },") print(f"{subqube.n_nodes = }, {subqube.n_leaves = },")
# requests.post( requests.post(
# API + "/union/climate-dt/", API + "/union/climate-dt/",
# headers = {"Authorization" : "Bearer ?????"}, headers = {"Authorization" : f"Bearer {secret}"},
# json = subqube.to_json()) json = subqube.to_json())
current_span = [current_span[0] - CHUNK_SIZE, current_span[0]] current_span = [current_span[0] - CHUNK_SIZE, current_span[0]]
print( print(