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

Reorder raw simulation like scen in ExtremeValues #84

Open
wants to merge 13 commits into
base: main
Choose a base branch
from

Conversation

coxipi
Copy link
Contributor

@coxipi coxipi commented Feb 22, 2025

Pull Request Checklist:

  • This PR addresses an already opened issue (for bug fixes / features)
    • This PR fixes #xyz
  • (If applicable) Documentation has been added / updated (for bug fixes / features).
  • (If applicable) Tests have been added.
  • CHANGELOG.rst has been updated (with summary of main changes).
    • Link to issue (:issue:number) and pull request (:pull:number) has been added.

What kind of change does this PR introduce?

  • reorder_sim option in ExtremeValues.adjust

extremes_adjust performs a GEV adjustment gev(ref,hist,sim) = adj_GEV, then it combines this with scen=adj_XYZ coming from a previous adjustment. The idea is simple to reorder sim before the
computation sim_r = reordering(ref=scen, sim=sim), and use this instead: gev(ref,hist,sim_r) = adj_GEV_r. The idea is that adj_GEV_r will be more synchronous with scen=adj_XYZ. So the maximal value of scen stays at the same place in time, but it get adjusted according to what is found from the GEV adjustment.

Other information:

GEV is written all over the place, but as @RondeauG pointed out, we in fact use a Generalized Pareto. The approach is a bit different (peak over threshold) but my point on the usefulness of reordering sim stands. I will think more about it

@coxipi
Copy link
Contributor Author

coxipi commented Feb 22, 2025

Another approach to this could be to add tail_options in all bias adjustment techniques? This could be:
ev_kwargs = {"q_thresh":q_thresh, "cluster_thresh":cluster_thresh}. In this way, we would not need to extract the reordered raw sim in the mbcn output, since it would be used in place for a GEV adjustments of large quantiles.

@coxipi
Copy link
Contributor Author

coxipi commented Feb 24, 2025

!!!This was wrong, I keep it for reference, but don't pay too much attention!!!

Some explorations. As I expected, working with non-synchronous sim/adjMBCn can lead to some problems

mbcn is just mbcn without GEV adjustment

mbcnOrdered reorders sim according to the reordering of mbcn, them performs the GEV adjustment.

mcbnDisordered is the same without reordering sim.

image

It's nothing huge though

@coxipi
Copy link
Contributor Author

coxipi commented Feb 24, 2025

!!!This was wrong, I keep it for reference, but don't pay too much attention!!!
A clearer plot: mbcn vs. mbcn-GEV for the two methods. For small values of pr, mbcn & mbcn-GEV should match (dotted line)

This might not make big differences in indicators at the end, but still, the difference is big enough IMO to justify changing algorithms

image

@coxipi
Copy link
Contributor Author

coxipi commented Feb 24, 2025

Actually I had reversed both datasets, so actually no reordering seems better in this case. I must have messed up the reordering implementation.

With group="time", it seems that the MBCn has pretty much the same rank structure as the raw simulation for large values:
image

However, for group="time.dayofyear, 31", the rank structure is more different, even for large values

image

@coxipi
Copy link
Contributor Author

coxipi commented Feb 24, 2025

Practically no difference between Disordered or Ordered for group="time"
image

But we the difference for group=Grouper("time.dayofyear",31)
image

@coxipi
Copy link
Contributor Author

coxipi commented Feb 24, 2025

That doesn't seem specific to MBCn though what I've just shown above. This is more about the fact that grouping with doy-31 has some effects on the rank structure. Consider the same plots as above with mbcn -> qdm

image

image

@coxipi
Copy link
Contributor Author

coxipi commented Feb 24, 2025

For reference, look at how the ranks are modified if we compare qdm-t and qdm to raw data (for tasmax here)

image

@coxipi
Copy link
Contributor Author

coxipi commented Feb 25, 2025

Interesting to see how much kind=* and kind=+ differ for the large precipitations. I think the justification of using was more about the variable being bounded by zero and not wanting to produce pr<0, but still, it has important effects for large values.

image

Oups, there should be cyan text saying: Max of QDM and QDM-GEV are the same points (for QDM-ordered)

In any case, here is the main point: You can see that if you don't reorder the simulation, the largest value in QDM is not necessarily the same point as the largest value in QDM-GEV. I don't think that's something we want to do, we don't want to destroy the rank structure that was found in the MBCn (although, as underlined previously, the major factor of re-ranking was more about group="time" and group="time.dayofyear,31" rather than the reordering inherent to MBCn )

@coveralls
Copy link

coveralls commented Feb 26, 2025

Coverage Status

coverage: 74.071% (+0.1%) from 73.97%
when pulling ae7752e on mbcn_keep_reordering
into f16c84c on main.

@coxipi coxipi changed the title Reorder raw simulation like mbcn-adj Reorder raw simulation like scen in ExtremeValues Feb 26, 2025
@coxipi
Copy link
Contributor Author

coxipi commented Feb 27, 2025

@RondeauG I just reordered sim in the adjust part. By default it is not used.

I would still like to clear up whether the GEV was being performed on a day-of-year grouping in ClimateTools.jl

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 this pull request may close these issues.

3 participants