Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
<!-- Please ensure the PR fulfills the following requirements! --> <!-- If this is your first PR, make sure to add your details to the AUTHORS.rst! --> ### 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. - [x] This PR does not seem to break the templates. - [x] CHANGELOG.rst has been updated (with summary of main changes). - [x] Link to issue (:issue:`number`) and pull request (:pull:`number`) has been added. ### What kind of change does this PR introduce? * Add annual global tas timeseries for CMIP6's models CanESM5 r1i1p2f1 (ssp126, ssp245, ssp370, ssp585), MPI-ESM1-2-LR ssp370 (r2i1p1f1, r3i1p1f1, r4i1p1f1, r5i1p1f1) (driving models of CRCM5) ### Does this PR introduce a breaking change? no ### Other information: for @mccrayc Done with this code: ``` import xscen as xs import xclim as xc import xarray as xr ds_tas=xr.open_dataset('../../src/xscen/data/IPCC_annual_global_tas_old.nc') #from PR270 de Pascal 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.resample(time='YS').mean() dam = xs.spatial_mean( day, region='global', method='cos-lat', spatial_subset=False ) dam['tas']= xc.units.convert_units_to(dam.tas, '°C') dam=dam.expand_dims('simulation').drop_vars('height').assign_coords( source=(("simulation",), [source]), data_source=(("simulation",),['From Amon with xscen'],), mip_era=(("simulation",), ['CMIP6']), experiment=(("simulation",), [exp]), member=(("simulation",), [member]), ) return dam new=[get_global_tas("MPI-ESM1-2-LR", 'ssp370', f'r{n}i1p1f1') for n in range(2,6)] new1 =[get_global_tas('CanESM5',exp,'r1i1p2f1') for exp in ['ssp126','ssp245','ssp370','ssp585']] #change from cftime to datetime new2=[] for ds in new1: ds['time']=ds.indexes['time'].to_datetimeindex() new2.append(ds) out = xr.concat([ds_tas] + new + new2, "simulation") out.attrs=ds_tas.attrs out['tas'].attrs=ds_tas['tas'].attrs display(ds_tas) display(out) xs.save_to_netcdf(out, '../../src/xscen/data/IPCC_annual_global_tas.nc') ```
- Loading branch information