ancillary¶
Ancillary functions for :
- managing dictionnaries of dictionnaries of dictionnaries of …
- converting acronyms to nice labels
- handling labelbars (using ImageMagick’s convert) : extract, assemble
-
ancillary.
amail
(text, subject='The subject', to=['senesi@posteo.net'], sender='job_on_ciclad@anymail.fr')[source]¶
-
ancillary.
choose_regrid_option
(variable, table, model, grid)[source]¶ Want to use a Cdo regrid option which can deal with published grid for Nemo, which has a band of missing values in Indian Ocean The return value is a dict of arg/values for regridn
-
ancillary.
concatenate_labelbars
(lbfile1, lbfile2, lbfile)[source]¶ Just put side-by-side the two figures in LBFILE1 and LBFILE2, producing LBFILE
-
ancillary.
create_labelbar
(figure_file, out_file, missing=True, captions_dir=None, width=1200, height=130, scheme='AR6', y_offset=630)[source]¶ Combine the labelbar part of FIGURE_FILE with a third picture showing the legend relevant for the AR5 or AR6 hatching scheme SCHEME can be AR5, AR6, AR6S (AR6 simple approach) or KS13 (Knutti & Sedlaceck 2013) Y_OFFSET is used for extracting labelbars (see fucntion extract_labelbars) WIDTH and HEIGHT are the target sizes for the output
-
ancillary.
create_labelbar2
(figure_file1, figure_file2, out_file, missing=True, captions_dir=None, width=2100, height=130, scheme='AR6', y_offset=630, ratio=4.0)[source]¶ Combine the labelbar part of FIGURE_FILE1 and FIGURE_FILE2 with a third picture showing the legend relevant for the AR5 or AR6 hatching scheme SCHEME can be AR5, AR6, AR6S (AR6 simple approach) or KS13 (Knutti & Sedlaceck 2013) Y_OFFSET is used for extracting labelbars (see fucntion extract_labelbars) WIDTH and HEIGHT are the target sizes for the output
-
ancillary.
extract_labelbar
(figure_file, labelbar_file, y_offset=630)[source]¶ Extract labelbar from FIGURE_FILE using external process and put it in LABELBAR_FILE. Use Y_OFFSET, an offset on y axis, for skipping the map part of the figure file. Default y_offste value is OK with Ncl maps as long as they have a ‘right string’
-
ancillary.
feed_dic
(dic, value, *keys, **kwargs)[source]¶ Similar to bash ‘mkdir -p’ for a dict() : creates intermediate levels of keys for storing value VALUE in dict DIC, as e.g. :
>>> d=dict() >>> feed_dic(d,3,1,"q") >>> print("d=",d) d= {1: {"q": 3}} >>> feed_dic(d,'a',1,4,"key") >>> print("d=",d) d= {1: {"q": 3, 4: {"key" : 'a'}}}
With keyword arg use_list=True, will rather assume that stored values are lists, and so will append VALUE :
>>> e=dict() >>> feed_dic(e,18,key1,key2,use_list=True) >>> feed_dic(e,19,key1,key2,use_list=True) >>> print("e=",e) e= {key1: {key2: [18, 19]}}
With keyword arg extend_list=True, will also assume that stored values are lists, and that VALUE is a list, and concatenate it with value in dic
With keyword arg use_count=True, will rather increment the dic value with VALUE (starting from 0) :
>>> e=dict() >>> feed_dic(e,2,"qq",3,use_count=True) >>> feed_dic(e,100,"qq",3,use_count=True) >>> print("e=",e) e= {"qq": {3: 102}}
-
ancillary.
prettier_label
= {'ANN': 'All seasons', 'DJF': 'DJF', 'JJA': 'JJA', 'P-E': 'P-E', 'ann': 'All seasons', 'drain': 'daily precipitation intensity', 'dry': 'dry days per year', 'evspsbl': 'evapotranspiration', 'mean_change': 'mean change', 'mean_rchange': 'mean percentage change', 'mean_schange': 'mean standardized change', 'means_rchange': 'percentage change of mean', 'median_change': 'median change', 'median_rchange': 'median percentage change', 'median_schange': 'median standardized change', 'mrro': 'runoff', 'mrso': 'soil moisture', 'mrsos': 'soil surface moisture', 'pr': 'precipitation', 'sos': 'sea surface salinity', 'ssp119': 'SSP1-1.9', 'ssp126': 'SSP1-2.6', 'ssp245': 'SSP2-4.5', 'ssp370': 'SSP3-7.0', 'ssp585': 'SSP5-8.5', 'ydrain': 'daily precipitation intensity', 'ydry': 'dry days per year'}¶ A dictionnary of pretty labels for some acronyms