stac_server

This commit is contained in:
Tom Hodson 2025-03-31 12:39:50 +00:00
parent cd26905261
commit 3017185950

View File

@ -23,22 +23,27 @@ app.add_middleware(
) )
qubes: dict[str, Qube] = {} qubes: dict[str, Qube] = {}
print("Getting climate and extremes dt data from github") # print("Getting climate and extremes dt data from github")
qubes["climate-dt"] = Qube.from_json( # try:
requests.get( # qubes["climate-dt"] = Qube.from_json(
"https://github.com/ecmwf/qubed/raw/refs/heads/main/tests/example_qubes/climate_dt.json" # requests.get(
).json() # "https://github.com/ecmwf/qubed/raw/refs/heads/main/tests/example_qubes/climate_dt.json",
) # timeout=3).json()
qubes["extremes-dt"] = Qube.from_json( # )
requests.get( # qubes["extremes-dt"] = Qube.from_json(
"https://github.com/ecmwf/qubed/raw/refs/heads/main/tests/example_qubes/extremes_dt.json" # requests.get(
).json() # "https://github.com/ecmwf/qubed/raw/refs/heads/main/tests/example_qubes/extremes_dt.json",
) # timeout=3).json()
mars_language = yaml.safe_load( # )
requests.get( # mars_language = yaml.safe_load(
"https://github.com/ecmwf/qubed/raw/refs/heads/main/config/climate-dt/language.yaml" # requests.get(
).content # "https://github.com/ecmwf/qubed/raw/refs/heads/main/config/climate-dt/language.yaml",
) # timeout=3).content
# )
# except:
qubes["climate-dt"] = Qube.empty()
qubes["extremes-dt"] = Qube.empty()
mars_language = {}
if "LOCAL_CACHE" in os.environ: if "LOCAL_CACHE" in os.environ:
base = Path(os.environ["LOCAL_CACHE"]) base = Path(os.environ["LOCAL_CACHE"])
@ -47,7 +52,7 @@ if "LOCAL_CACHE" in os.environ:
mars_language = yaml.safe_load(f)["_field"] mars_language = yaml.safe_load(f)["_field"]
if "API_KEY" in os.environ: if "API_KEY" in os.environ:
print("Getting data from local file") api_key = os.environ["API_KEY"]
else: else:
with open("api_key.secret", "r") as f: with open("api_key.secret", "r") as f:
api_key = f.read() api_key = f.read()