-
Notifications
You must be signed in to change notification settings - Fork 2
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
Resample to seasons - exclude seasons with missing months #80
Comments
Does Edit: I ask, because |
@RondeauG, Chris doesn't use the |
Je suis d'avis que So, @mccrayc how much more work would it be for you to add an indicator-computation workflow? If the answer is "more than enough" I think we could indeed add a completeness check in the resample step of the extraction. |
@mccrayc The other way to do it would be to extract the daily files and let The issue here ( and why I didn't bring it up sooner in SO) is that xclim doesn't have a pr_mean indicator... |
Xclim does have a "pr_mean" indicator, but it has another name since it exposes more functionality: It's the daily average intensity ON WET DAYS, which is the nuance. But you could pass seasonal_pr_mean:
base: sdii
cf_attrs:
var_name: pr_mean
parameters:
thresh: -1 mm/d
freq: QS-DEC |
In my case I am using the monthly statistics that are already archived to save time on calculations (e.g., the files in /tank/climato/arch/cau/statmens). I haven't yet taken the time to fully explore the indicator functionality of xclim, but at first glance it seems that most of the indicators are based on daily values? Since my data are just monthly means of tas, tasmax, tasmin and pr it seemed much simpler to do the averages this way. But maybe it's simpler than I am understanding to extend the daily indicators for use with monthly data? |
Hum indeed xclim is more oriented towards daily inputs. I mean, it's a simple problem, so it may be easier to just do it (instead of waiting for a fix in xscen): (to be inserted after the extract and before the climatological mean)
ds_qs = ds_ms.resample(time='QS-DEC').mean().isel(time=slice(1, -1))
ds_qs = ds_ms.resample(time='QS-DEC').mean()
missing = xc.core.missing.missing_any(ds, 'QS-DEC', src_timestep='M')
ds_qs = ds_qs.where(~missing) But I agree with implementing some fail-safe option in |
|
Coming back to this. If we want to support coarser temporal resolutions in
The potential issue I see with this is if the data is already coarser than daily (e.g. |
There doesn't seem to be any pretty way to apply a weighted
For |
Addressing a Problem?
Currently, resampling data to seasons (e.g., with frequency = 'QS-DEC') can result in partial seasons being counted the same as full seasons. For example, with data for Jan 1980-Dec 1981, Jan 1980 and Dec 1981 will each count as one DJF period even though they are only one month. The DJF mean will then = [Dec 1980 + (Dec 1980-Feb 1981) + Dec 1981]/3. For climatological calculations, Jan 1980-Dec 1981 should probably only give one DJF period (Dec 1980-Feb 1981) but two periods for the other seasons. Having different numbers of periods for each of the seasons can complicate parameter selection for xs.climatological_mean().
Potential Solution
ds_clim = xs.climatological_mean(ds=ds_dict['QS-DEC'], window=2, interval=2, min_periods = 1, to_level="2yr-climatology")
Additional context
One challenge is that the metadata generated is largely based on the number if years (e.g., "2yr-climatology") which might be a bit misleading when there is 1 fewer DJF period than the other seasons. Perhaps the metadata can be adapted to take this into account for seasonal calculations.
The text was updated successfully, but these errors were encountered: