-
Notifications
You must be signed in to change notification settings - Fork 19
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
Working with the s5 forecast data #131
Comments
To select by forecast horizon # map forecast horizons to months ahead
map_ = {
pd.Timedelta('28 days 00:00:00'): 1,
pd.Timedelta('29 days 00:00:00'): 1,
pd.Timedelta('30 days 00:00:00'): 1,
pd.Timedelta('31 days 00:00:00'): 1,
pd.Timedelta('59 days 00:00:00'): 2,
pd.Timedelta('60 days 00:00:00'): 2,
pd.Timedelta('61 days 00:00:00'): 2,
pd.Timedelta('62 days 00:00:00'): 2,
pd.Timedelta('89 days 00:00:00'): 3,
pd.Timedelta('90 days 00:00:00'): 3,
pd.Timedelta('91 days 00:00:00'): 3,
pd.Timedelta('92 days 00:00:00'): 3,
}
fhs = [pd.Timedelta(fh) for fh in stacked.forecast_horizon.values]
months = [map_[fh] for fh in fhs]
stacked = stacked.assign_coords(months_ahead=('time', months)) Which we can then use to subset the data as follows:
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
the s5 data has lots of nuances
so in order to be a complete xarray object there are 4 different
forecast_horizons
for each month so that the only array with non-nan values is when thevalid_time
is the first of the next month.the
forecast_horizon
is set to a size of 9 (28days, 30days, 31days + 30 + 60 ...) which is the way to code n month forecasts (1month = 28/30/31 depending on the length of the month).So these forecasts are all initialised on
2014-01-01
and January is 31 days long. So the only valid data comes from the 3rd indexedforecast_horizon
(here coded asstep
) which corresponds to 31 days. This takes thevalid_time
to2014-02-01
which is the month ahead. Whereas February/March are 59 days long total. So the 4th indexedforecast_horizon[3]
corresponds to 59 days which is the valid step here (valid_time
==2014-03-01
)We need a way to get the valid timesteps so that we have a complete xarray object with data at each timestep. I can think of a few ways but we could document them here.
The text was updated successfully, but these errors were encountered: