Ouranosinc / xscen

A climate change scenario-building analysis framework.
https://xscen.readthedocs.io/
Apache License 2.0
17 stars 2 forks source link

Better global tas database and warming level methods #270

Closed aulemahal closed 11 months ago

aulemahal commented 1 year ago

Pull Request Checklist:

What kind of change does this PR introduce?

Addition of:

CMIP6_CMCC-ESM2_ssp245_r1i1p1f1
CMIP6_CMCC-ESM2_ssp370_r1i1p1f1
CMIP6_CMCC-ESM2_ssp585_r1i1p1f1
CMIP6_EC-Earth3-CC_ssp245_r1i1p1f1
CMIP6_EC-Earth3-CC_ssp585_r1i1p1f1
CMIP6_KACE-1-0-G_ssp245_r1i1p1f1
CMIP6_KACE-1-0-G_ssp370_r1i1p1f1
CMIP6_KACE-1-0-G_ssp585_r1i1p1f1
CMIP6_TaiESM1_ssp245_r1i1p1f1
CMIP6_TaiESM1_ssp370_r1i1p1f1

to xscen/data/IPCC_annual_global_tas.csv.

Does this PR introduce a breaking change?

Yes, if get_warming_level is called with a sequence of models, the output is now a list of the same length. The dictionary can be retrieved by passing output='selected'. I found it way more useful this way!

Other information:

The new global tas were computed with the following code:

def get_global_tas(source, exp, member):
    scats = xs.search_data_catalogs(
        'catalogues/simulation.json',
        {'tas': 'MS'},
        other_search_criteria={'source': source, 'experiment': exp, 'member': member, 'processing_level': 'raw'},
        match_hist_and_fut=True
    )
    ds = xs.extract_dataset(scats.popitem()[1])['MS']
    day = ds.tas.resample(time='YS').mean()
    dam = xs.spatial_mean(
        day,
        region='global',
        method='cos-lat',
        spatial_subset=False
    )
    tas = xc.units.convert_units_to(dam, '°C')
    return tas.rename(time='year').assign_coords(year=tas.time.dt.year.values)

See issue #268 for discussion of small differences between this and the official IPCC-provided data.

juliettelavoie commented 1 year ago

do we want to add the source to the original data in the csv ? Technically, it is here: https://github.com/Ouranosinc/xscen/blob/b3c79cd02f01c9f791d082459464b0842b5f4f6c/xscen/extract.py#L861C2-L861C2 (not exactly the github page with the data, but the paper links to the repo)

but maybe it needs to be in the csv also? (while we are here anyway)

aulemahal commented 1 year ago

Good idea!

review-notebook-app[bot] commented 1 year ago

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

aulemahal commented 1 year ago

Last commits are a rewrite of get_warming_level and subset_warming_level so they're easier to use with arrays.

See changes of the warming level notebook for most explanations. And edit on the root comment.

aulemahal commented 1 year ago

@sarahclaude Should I use this PR to add the global tas average for non-r1i1p1f1 models ? Will you need that ?

sarahclaude commented 1 year ago

I might need it in the future but we are not dealing with warming levels yets, so not on short-term.

aulemahal commented 11 months ago

PR prête pour la revue.

J'ai laissé faire les membres non-r1i1p1f1 pour le moment. Les modèles ajoutés sont essentiellement ceux qui manquaient de ESPO-G6.

RondeauG commented 11 months ago

There's output to potentially remove, but other than that, this looks good to go!

Zeitsperre commented 11 months ago

Docs are failing because a file only in this branch isn't present in main. Let me know if you want me to bypass protections to push to main!