Closed almarbo closed 5 months ago
the provided notebook has been updated to meet the developments followed in #132
Hi @almarbo,
I have a few suggestions:
timeseries
should be a variable of the same type for energy and temperature/precipitation (e.g., a dict mapping a tuple of indices to a string).xr.set_options
). If you really need to do that, use the context manager (e.g., with xr.set_options
, ...). When I introduced xr.set_options
in the templates I thought you wanted to use the same cmaps for all plots. If that's not the case, I would add a cmap argument to the plotting functions, then I would explicitly use those args. E.g., da.plot(cmap=cmap_sequential)
could it be done so that the ensemble spread cbar is always "viridis"
If you implement my third suggestion, you should be able to address that as well. (BTW, not sure if that's related to your question, but you can pass the parameter center=False
to xarray plots in order to force the use of sequential cmaps)
Do you need me to cache this notebook?
hi @malmans2 could we have a quick chat about these points?
Sure. I'm available right now if that works for you.
Are you available at 12?
Yes, I'll send you the invite
hi @malmans2 the notebook has been updated to have a version focusing only on the energy-consumption indices
Hi @almarbo
Can I remove the parametrization of variable? It's not needed right? This is going to be a template for energy only, right?
You are right. You can remove It sure
I see various references to cordex (some of those variables are not used). Can I remove them?
Sure, you can remove them. I am seeing that I removed some of them but forgot some others
I don't follow this:
def select_timeseries(ds, timeseries, year_start, year_stop, index_names):
if timeseries == "annual":
return ds.sel(time=slice(str(year_start), str(year_stop)))
return ds.sel(time=slice(f"{year_start-1}-12", f"{year_stop}-11"))
timeseries is a dictionary now, correct? Also, how do you select the timeseries when users have both DJF and annual in the same dict? Should we drop support for annual in this notebook? Or maybe we should force users to either use annual or seasonal for all timeseries?
I like this option
Or maybe we should force users to either use annual or seasonal for all timeseries?
Do you need to cache just deficit and excess? Or do you need other variables as well for plotting?
Just deficit and excess
I started the template here, although I haven't really tested it yet: https://github.com/bopen/c3s-eqc-toolbox-template/blob/main/notebooks/wp4/cmip6_energy_indices.ipynb
I need to add plots now. Are you going to show the usual plots with custom colormaps? Can I copy/paste from this template?
Yes! No problem
Actually, that's not correct. In the hist vs future you only plotted the index, looks like here you want to plot trends as well. So I need to copy/paste from the other templates.
The template is ready.
Let me know if we can close this issue
Thanks a lot! Look nice. Should I open a new issue for the future? Basically It should be the same analysis as here but changing the request experiment
parameter (from "historical" to "ssp5_8_5") and the period of the slice (2015-2099).
No this is fine. I've updated the template and I'm caching it right now. (Are you sure that 2015 is OK for all models? I seems to remember that a few models don't have 2014 available needed for DJF, but maybe I'm wrong)
You remember well, thanks. Let's start on 2016 then
Hi @almarbo,
Basically It should be the same analysis as here but changing the request experiment parameter (from "historical" to "ssp5_8_5") and the period of the slice (2015-2099)
This is not correct. There's no future projection for ERA5, so we can't compare to ERA5.
You are right. the analysis is similar but not the same, and some other things need to be taken into consideration. The analysis should be similar to what is done on the future template for the extreme indices but adapted to energy-indicators https://github.com/bopen/c3s-eqc-toolbox-template/blob/main/notebooks/wp4/extreme_indices_future.ipynb (i.e., the data should be regridded to "gfdl_esm4" and also in the original grid, no bias calculations are needed...). If you need me to make clear some other aspects just let me know.
I'm having troubles downloading CMIP6 from the CDS. Looks like there are issues right now as I get "An internal error occurred processing your request"
I'll try again after lunch, and will open a ticket if needed.
yes, I am getting the same error
Looks like there are issues right now as I get "An internal error occurred processing your request"
perfect!
I'll try again after lunch, and will open a ticket if needed.
I'm getting intermittent errors. I didn't open a ticket as it usually gets fixed by rerunning the job. It's a bit slower but looks like I'm able to download.
BTW, there's something I don't fully understand. The other day you told me that you are running the notebooks on your machine, making changes to the cached functions. But the environment your shared in the permalink repo is the environment of the VM.
I didn't open a ticket as it usually gets fixed by rerunning the job. It's a bit slower but looks like I'm able to download.
Nevermind, now it's getting much more frequent. I'm opening the ticket.
Looks like the CDS issue is fixed, I was able to download the data this morning.
Can we close this issue?
Hi @malmans2
thanks for running it, the results look fine.
I have just noticed that for the trend of ERA5, no units are displayed. Could we fix this?
Before closing it, we would need to have a version that includes future vs historical. The structure should be the one followed at: https://github.com/bopen/c3s-eqc-toolbox-template/blob/main/notebooks/wp4/extreme_temperature_indices_future_vs_historical.ipynb but adapted to the energy-case. Could it be done?
I have just noticed that for the trend of ERA5, no units are displayed. Could we fix this?
Will do
Before closing it, we would need to have a version that includes future vs historical. The structure should be the one followed at: https://github.com/bopen/c3s-eqc-toolbox-template/blob/main/notebooks/wp4/extreme_temperature_indices_future_vs_historical.ipynb but adapted to the energy-case. Could it be done?
Will do, but it's a bit vague. I need all the specs to implement it. For example, TX90p
is treated one way, the other are treated differently. Which one should I use?
It should be treated as the "SU" index i.e, what should be calculated is the difference between the mean over the thirty-year future period (corresponding to a global warming level of 2degrees) and the mean over the thirty-year of the historical period.
Will do, but it's a bit vague. I need all the specs to implement it. For example, TX90p is treated one way, the other are treated differently. Which one should I use?
Let me know whatever you need me to clarify.
You are using this "cnrm_cm6_1_hr": slice(2015, 2044)
, but that model is not available in 2014 (needed for DJF).
How do you want to change it?
It is okay to just consider the year after:
"cnrm_cm6_1_hr": slice(2016, 2045)
All set: https://gist.github.com/malmans2/6815e98f270110047fe07e5032fda00e
Please take a look and let me know if it works OK.
hi @malmans2
it looks fine! Tomorrow I will look more into detail and then I think we can close this issue.
thanks a lot
Sounds good, take your time.
Hi @malmans2 I have tested it and looks fine everything, I think we can close this issue
Notebook description
In this notebook, data from a subset of 9 models of CMIP6 Global Climate Models (GCM) , as well as ERA5 reanalysis, are considered. Two energy-demand ECA&D indices are calculated using the icclim Python package: Cooling and Heating Degree Days (CDDs and HDDs respectively). The reference methodology used by the EEA and implemented here follows the approach developed by Spinoni et al., 2018. In line with Spinoni's methodology, this notebook adopts a winter comfort temperature of 15.5°C and a summer comfort temperature of 22.0°C. These comfort temperatures remain constant across Europe. A higher number of Heating Degree Days (HDD) indicates that outdoor temperatures fall below the winter comfort threshold, necessitating more energy to heat buildings. Similarly, a higher number of Cooling Degree Days (CDD) indicates outdoor temperatures exceeding the summer comfort level, requiring increased energy for cooling buildings. In the presented code, the CDD calculations are always based on the JJA aggregation, with a comfort temperature of 22°C, while HDD calculations focus on winter (DJF) with a comfort temperature of 15.5°C. This notebook performs the analyses for the historical period from 1971 to 2000 (Historical)
Notebook link or upload
historical_CMIP6_CDD_indices.ipynb.zip
Anything else we need to know?
The notebook incorporates the development and improvements ongoing at #132 . The period for the historical remain the same : 1971-2000
The main change has to do with the use of icclim and the fact that each index is performed over different temporal aggregations (DJF for the HDD15.5 index and JJA for the CDD22). Here you can find an example of the way icclim is used for the historical period within the
compute_indices
function:Note that some parameters are new:
Specific question: could it be done so that the ensemble spread cbar is always "viridis"?
Environment