Commit 70bda81c9317c3751fe6c0553ded6dcc681acbfc
1 parent
34c81ff3
Fix date display in csfootprint (#4299)
Showing
6 changed files
with
20 additions
and
8 deletions
ChangeLog
NEWS
1 | 1 | New Features and Important Changes in ctools 2.1.0 |
2 | 2 | |
3 | -8 April 2023 | |
3 | +12 May 2023 | |
4 | 4 | |
5 | 5 | |
6 | 6 | Introduction |
... | ... | @@ -162,6 +162,11 @@ csfindobs - Find IACT observations |
162 | 162 | None |
163 | 163 | |
164 | 164 | |
165 | +csfootprint - Generates carbon footprint report | |
166 | +----------------------------------------------- | |
167 | +Display now dates instead of days since start for daily statistic (#4299). | |
168 | + | |
169 | + | |
165 | 170 | csiactcopy - Copy IACT observations |
166 | 171 | ----------------------------------- |
167 | 172 | None | ... | ... |
README.md
1 | 1 | ctools information |
2 | 2 | ================== |
3 | -* Version: 2.1.0.dev (8 April 2023) | |
3 | +* Version: 2.1.0.dev (12 May 2023) | |
4 | 4 | * GammaLib dependency: 2.1.0.dev |
5 | 5 | |
6 | 6 | [![Build Status](https://cta-jenkins.irap.omp.eu/buildStatus/icon?job=ctools-integrate-os)](https://cta-jenkins.irap.omp.eu/job/ctools-integrate-os/) | ... | ... |
cscripts/csfootprint.py
... | ... | @@ -422,7 +422,7 @@ class csfootprint(ctools.cscript): |
422 | 422 | self._log_value(gammalib.NORMAL, ' due to infrastructure', info['gCO2e_infra']) |
423 | 423 | self._log_value(gammalib.NORMAL, 'Average carbon intensity', info['ci_cpu']) |
424 | 424 | self._log_value(gammalib.NORMAL, 'Average daily footprint', info['fp_dur']) |
425 | - self._log_value(gammalib.NORMAL, 'Expected annual footprint', info['fp_yr']) | |
425 | + self._log_value(gammalib.NORMAL, 'Estimated annual footprint', info['fp_yr']) | |
426 | 426 | |
427 | 427 | # Return |
428 | 428 | return |
... | ... | @@ -664,7 +664,7 @@ class csfootprint(ctools.cscript): |
664 | 664 | fig.text(x0, y0, 'Average daily footprint: ', fontsize=fontsize, ha='left') |
665 | 665 | fig.text(x0+dx, y0, info['fp_dur'], fontsize=fontsize, ha='left') |
666 | 666 | y0 -= dy |
667 | - fig.text(x0, y0, 'Expected annual footprint: ', fontsize=fontsize, ha='left') | |
667 | + fig.text(x0, y0, 'Estimated annual footprint: ', fontsize=fontsize, ha='left') | |
668 | 668 | fig.text(x0+dx, y0, info['fp_yr'], fontsize=fontsize, ha='left') |
669 | 669 | |
670 | 670 | # Optionally display figure for debugging |
... | ... | @@ -707,8 +707,12 @@ class csfootprint(ctools.cscript): |
707 | 707 | yscale : float, optional |
708 | 708 | Y axis scale |
709 | 709 | """ |
710 | + # Import modules for handling of dates | |
711 | + from matplotlib import dates as mdates | |
712 | + from datetime import datetime as dt | |
713 | + | |
710 | 714 | # Create bar data |
711 | - days = [i for i, _ in enumerate(statistics['daily'])] | |
715 | + days = [dt.strptime(entry['date'], '%Y-%m-%d').date() for entry in statistics['daily']] | |
712 | 716 | data = [entry[quantity]*yscale for entry in statistics['daily']] |
713 | 717 | |
714 | 718 | # Plot bar data |
... | ... | @@ -716,7 +720,7 @@ class csfootprint(ctools.cscript): |
716 | 720 | |
717 | 721 | # Set labels |
718 | 722 | ax.set_title(title) |
719 | - ax.set_xlabel('Days since %s' % statistics['use_start'][0:10]) | |
723 | + ax.set_xlabel('Date') | |
720 | 724 | ax.set_ylabel(ylabel) |
721 | 725 | |
722 | 726 | # Return | ... | ... |
doc/source/admin/release_history/2.1.rst
... | ... | @@ -16,6 +16,8 @@ In particular, this release provides: |
16 | 16 | Bug fixes |
17 | 17 | --------- |
18 | 18 | |
19 | +* [`4299 <https://cta-redmine.irap.omp.eu/issues/4299>`_] - | |
20 | + Fix date display in :ref:`csfootprint` | |
19 | 21 | * [`4223 <https://cta-redmine.irap.omp.eu/issues/4223>`_] - |
20 | 22 | Replace ``distutils`` by ``setuptools`` for Python setup |
21 | 23 | * [`4187 <https://cta-redmine.irap.omp.eu/issues/4187>`_] - | ... | ... |
doc/source/users/reference_manual/index.rst
... | ... | @@ -34,6 +34,7 @@ Generic analysis tools and scripts |
34 | 34 | cstsdist --- Generates Test Statistic distribution <cstsdist> |
35 | 35 | cstsmapmerge --- Merges slices from Test Statistic map computations <cstsmapmerge> |
36 | 36 | cstsmapsplit --- Creates commands to split the Test Statistic map computations <cstsmapsplit> |
37 | + csfootprint --- Generates carbon footprint report <csfootprint> | |
37 | 38 | |
38 | 39 | |
39 | 40 | CTA and IACT analysis tools and scripts |
... | ... | @@ -57,7 +58,6 @@ CTA and IACT analysis tools and scripts |
57 | 58 | ctskymap --- Generates sky map <ctskymap> |
58 | 59 | csbkgmodel --- Generates background model for 3D analysis <csbkgmodel> |
59 | 60 | csebins --- Generates energy boundaries for stacked analysis <csebins> |
60 | - csfootprint --- Generates carbon footprint report <csfootprint> | |
61 | 61 | csobsdef --- Generates observation definition file <csobsdef> |
62 | 62 | csobsselect --- Select observations from observation definition file <csobsselect> |
63 | 63 | csphagen --- Generates PHA, ARF, RMF files based on source/background regions <csphagen> | ... | ... |