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

Does this computation know about the days in a month? #17

Open
StephenGriffies opened this issue May 7, 2023 · 2 comments
Open

Does this computation know about the days in a month? #17

StephenGriffies opened this issue May 7, 2023 · 2 comments

Comments

@StephenGriffies
Copy link
Contributor

Computing an annual climatology from monthly means requires one to know the number of days in a month. Does this command know that information? How? It depends on leap-year or no-leap. Where is that information accessed?

https://github.com/raphaeldussin/MOM6-AnalysisCookbook/blob/3cf066aefe3d37e1ed57d8817f30e229138b366b/docs/notebooks/time_operations.ipynb#L233

@jetesdal
Copy link
Contributor

jetesdal commented May 8, 2023

As far as I know this method does not account for the number of days in each month and will weigh each month equally to calculate the annual mean. We should probably include the method where the number of days in each month are accounted for. I think you could use the xarray.DataArray.weighted() method to do that. If you have a separate array like delta_t (e.g., number of seconds) with the same time axis, you could use that to do the accurate weighting. That should also take care of distinguishing leap from no-leap years.

@StephenGriffies
Copy link
Contributor Author

This tutorial from xarray documentation details how to get the weights.

https://docs.xarray.dev/en/stable/examples/monthly-means.html

I suggest we offer something compatible with that tutorial so that MOM6 users can compute consistent monthly climatologies.

We know that equal weights is wrong (5-10% wrong), so should offer a proper approach. Weighted averages are commonly desired for other applications too, so this example could provide the template for others.

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