# HG changeset patch # User climate # Date 1657357290 0 # Node ID 7f84fb995f4e09c6489d7a69bda79dcc991247cb # Parent 645e533f826997d3b412c5f181d697af35c379f4 planemo upload for repository https://github.com/NordicESMhub/galaxy-tools/tree/master/tools/climate-stripes commit e4c144851549600ffde5bcf875304d5edd98e2b1 diff -r 645e533f8269 -r 7f84fb995f4e climate-stripes.xml --- a/climate-stripes.xml Tue Apr 14 19:07:32 2020 +0000 +++ b/climate-stripes.xml Sat Jul 09 09:01:30 2022 +0000 @@ -1,9 +1,16 @@ - + from timeseries + + topic_3855 + topic_3318 + + + operation_0337 + python - matplotlib - pandas + matplotlib + pandas @@ -28,6 +38,7 @@
+ @@ -127,6 +138,7 @@ + diff -r 645e533f8269 -r 7f84fb995f4e climate_stripes.py --- a/climate_stripes.py Tue Apr 14 19:07:32 2020 +0000 +++ b/climate_stripes.py Sat Jul 09 09:01:30 2022 +0000 @@ -72,7 +72,10 @@ self.plot_format = plot_format.replace('X', '%') def read_data(self): - self.data = pd.read_csv(self.input, sep='\t') + if self.xname is not None: + self.data = pd.read_csv(self.input, sep='\t', index_col=self.xname, infer_datetime_format=True) + else: + self.data = pd.read_csv(self.input, sep='\t') def create_stripes(self): data = np.zeros((2, self.data[self.valname].shape[0]), dtype='float') @@ -86,16 +89,11 @@ vmax=self.data[self.valname].quantile(q=0.99)) if self.title: plt.title(self.title) - if self.xname: + if self.xname is not None: nrange = self.data.index.values - n = int(np.floor((nrange.max() - nrange.min())/int(self.nxsplit))) - date_list = self.data[self.xname].loc[::n].apply( - lambda x: pd.to_datetime(str(x), - format=self.format)) + date_list = pd.to_datetime(nrange[::int(self.nxsplit)], format=self.format) date_list = [i.strftime(self.plot_format) for i in date_list] - nval = int(self.data[self.xname].loc[::n].shape[0]) - ax.xaxis.set_major_locator(plt.MaxNLocator(nval)) - ax.xaxis.set_ticklabels(date_list) + ax.set_xticks(np.arange(0, len(nrange), int(self.nxsplit)), date_list) ax.xaxis.set_tick_params(rotation=45) else: ax.set_xticks([]) diff -r 645e533f8269 -r 7f84fb995f4e test-data/T2Mstripes_with_axis.png Binary file test-data/T2Mstripes_with_axis.png has changed