Conversation
| if k not in kwargs: | ||
| kwargs.update({k: v}) | ||
| return super().format(format_string, *args, **kwargs) | ||
| kwargs["np"] = np # noqa |
There was a problem hiding this comment.
A bit ugly, maybe there is a better way to add numpy in jinja rendering namespace
| "temperature both exceeds specific thresholds : " | ||
| "(Tmin > {thresh_tasmin} and Tmax > {thresh_tasmax}) " | ||
| "over a minimum number of days ({window}).", | ||
| "{% if np.isscalar(thresh_tasmin) and np.isscalar(thresh_tasmax)" |
There was a problem hiding this comment.
Here is the template for heat_wave_frequency
|
I tried to mitigate the changes by applying both AttrFormatter and jinja templating.
So, this prints |
|
For the record, I'm working (in icclim) on generic indicators which would fully utilize jinja templating to generate rich metadata. |
|
Unfortunately, I don't think I will be able to work much more on this PR (or generic indicators in xclim), my contract at cerfacs ends soon and I don't know yet if I will continue working on climate indices afterward. |
|
Hi Abel, sorry to hear that, we really enjoyed your contributions to the project. Yes, it would be useful for us to get a sense of where things stand so we can work on the xclim port. Let us know when is a good time for you. |
Pull Request Checklist:
number) and pull request (:pull:number) has been added.zenodo.jsonWhat kind of change does this PR introduce?
Follow up to discussions in here: #1093
This pr is a proof of concept to get an idea of how jinja can be used to format indicator descriptions.
Does this PR introduce a breaking change?
No, it should not.
Other information:
To illustrate the results with heat_wave_frequency:
prints
"Ys number of heat wave events over a given period. an event occurs when the minimum and maximum daily temperature both exceeds specific thresholds : (tmin > 22.0 degc and tmax > 30 degc)over a minimum number of days (3)."