Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Find latest run with all timesteps #13

Closed
guidocioni opened this issue Sep 1, 2022 · 2 comments
Closed

Find latest run with all timesteps #13

guidocioni opened this issue Sep 1, 2022 · 2 comments

Comments

@guidocioni
Copy link

I know that the latest() function returns the latest run for a specific setting, but this consider all runs, also those that stil don't have all files online.
Is there a way to find the latest complete run with all steps present on the server?
I tried to specify step in the request but that didn't work.

@packman2008
Copy link

The following code could be simplified but I've left it in this state because (I think) it shows better how it works...

`#!/usr/bin/python3

import re
from datetime import datetime
from ecmwf.opendata import Client

client = Client(source="ecmwf")

format = '%Y%m%d%H'

latest_90_run = client.latest(
type="fc",
step=90,
param=["2t"],
)

latest_90_date = latest_90_run.strftime(format)

latest_144_run = client.latest(
type="fc",
step=144,
param=["2t"],
)

latest_144_date = latest_144_run.strftime(format)

if (latest_144_date == latest_90_date):
print(latest_144_date)
else:
print(latest_90_date)
`
Issue #11 reports a fault with the client.latest function where it errors when the 18z run is the last run. The code above fors for runs 00z, 06z and 12z at the moment.

@guidocioni
Copy link
Author

Yep, that's what I also experienced.
For the moment I'm relying on a bash script to get the latest run, I think it should be fine for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants