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

converting 360_day calendar create temperature inversion #102

Closed
juliettelavoie opened this issue Oct 10, 2022 · 2 comments · Fixed by #104
Closed

converting 360_day calendar create temperature inversion #102

juliettelavoie opened this issue Oct 10, 2022 · 2 comments · Fixed by #104

Comments

@juliettelavoie
Copy link
Contributor

Generic Issue

  • xscen version: xs.version
  • Python version: 3.9.10
  • Operating System: mac

In clean_up, when we convert a 360_day to a standard calendar with the default xscen parameters, we create temperature inversions.

In xscen, the default align_on is set to random if the input ds is a 360_day calendar. However, it looks like the random dates that are choosen to expand the calendar to standard are not the same for all the variables in the dataset. Eg. xclim.convert_calendar might insert a nan on January 23rd for tasmin, but insert a nan on January 31st for tasmax.

Next, xscen will interpolate on those nan. This has the effect of shifting the timeseries. In some occasions, shifting tasmax but not tasmin with create a temperature inversion (tasmin>tasmax).

The top lines are tasmax, the bottom lines are tasmin.

image

Potential solutions:

  1. Set default align_on year. The down side is that the the same date will always be interpolated.
  2. Change xclim to make random the same for tasmax et tasmin ?
@aulemahal
Copy link
Collaborator

Woupelaye indeed, this isn't so nice!

Your solution 1 doesn't seem so bad to me, that's what we were doing previously and there aren't many 360_day datasets, anyway, no?

Also, I see three ways for number 2:

  1. In xscen, pass the dataset instead of iterating on the variables.
  2. In xclim, have a fancy year-based seed, so that a given year will always generate the same 5 or 6 days to skip. There could also be a "seed" argument to the function so that we can have variability between runs.
  3. In xclim, return the list of added days and pass the list to subsequent calls of convert_calendar.

@juliettelavoie
Copy link
Contributor Author

solution 1: yes, there is only 1/8 model for info-crue that have 360_day calendar.

solution 2:

  1. I think this is this the way to do it. I have modified the code so that all variables that use "interpolate" in missing_by_var will be converted at the same time. Variables that have a different missing (like [0] for pr) are converted separately, but I don't think this will cause problems.

This is what it looks like now.

image

@juliettelavoie juliettelavoie mentioned this issue Oct 11, 2022
6 tasks
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

Successfully merging a pull request may close this issue.

2 participants