Plot a time-lag figure with multiple sources (x, previous values; y, future values)
draw_time_lag(ncfile, values)
ncfile = '#' list of couples ('%' formed) [prefilen];[predslice];[pretvarn];[prevarn]%[futfilen];
[futdslice];[futtvarn];[futvarn]
'pre': values to act as previous values
'fut': values to act as future values
[filen]: name of the file
[dimslice]: '|' list of [dimn],[dimrange]
[dimn]: name of the dimension
[dimrange]: range for the slice
* [integer]: which value of the dimension
* -1: all along the dimension
* -9: last value of the dimension
* [beg]@[end]@[inc] slice from [beg] to [end] every [inc]
* NOTE, no dim name all the dimension size
[tvarn]: name of the variable time
[yvarn]: name of the variable to use for the values
values = [dimxyfmt];[axeskind];[preaxislab];[preunits];[futaxislab];[futunits];[prerangevals];
[futrangevals];[timevals];[labels];[figlagkind];[graphtit];[legvalues];[kindfig];[fign];[close]
[dimxyfmt]=[dxs],[dxf],[Ndx],[ordx],[dys],[dyf],[Ndy],[ordy]: format of the values at each
axis (or single 'auto' for 'auto','auto')
[dxs]: style of x-axis ('auto' for 'pretty')
'Nfix', values computed at even 'Ndx'
'Stringlist', a given list of strings
'Vfix', values computed at even 'Ndx' increments
'pretty', values computed following aprox. 'Ndx' at 'pretty' intervals (2.,2.5,4,5,10)
[dxf]: format of the labels at the x-axis
[Ndx]: Number of ticks at the x-axis (for 'Stringlist', '@' list of labels)
[ordx]: angle of orientation of ticks at the x-axis ('auto' for horizontal)
[dys]: style of y-axis ('auto' for 'pretty')
[dyf]: format of the labels at the y-axis
[Ndy]: Number of ticks at the y-axis
[ordy]: angle of orientation of ticks at the y-axis ('auto' for horizontal)
[axeskind]: type of axes to be plotted
'centered': crossed at 0,0 at the center of the figure
'box': around the figure
[preaxislab]: Label for the future-axis ('!' for spaces)
[preunits]: units of the future-label
[futaxislab]: Label for the future-axis ('!' for spaces)
[futunits]: units of the future-label
[prerangevals]: Range of the previous axis with the values (single 'None' for 'auto','auto')
[vmin],[vmax]: minimum and maximum values
'auto': the computed minimumm or maximum of the values
[futrangevals]: Range of the future axis with the values (single 'None' for 'auto','auto')
[vmin],[vmax]: minimum and maximum values
'auto': the computed minimumm or maximum of the values
[timevals]: [timen]|[units]|[kind]|[tfmt] time labels characteristics
[timen]; name of the time variable
[units]; units string according to CF conventions ([tunits] since
[YYYY]-[MM]-[DD] [[HH]:[MI]:[SS]], '!' for spaces)
[kind]; kind of output
'Nval': according to a given number of values as 'Nval',[Nval]
'exct': according to an exact time unit as 'exct',[tunit];
tunit= [Nunits],[tu]; [tu]= 'c': centuries, 'y': year, 'm': month,
'w': week, 'd': day, 'h': hour, 'i': minute, 's': second,
'l': milisecond
[tfmt]; desired format
[labels]: ',' list of labels for the legend ('None' for no-labels, '!' for spaces)
[figlagkind]=[kindname],[valueskind] kind of time-lag plot
'repeatPeriod',[Nlag],[period],[colorbar],[cbarfmt],[cbaror],[ltype],[lwidth],[mtype],[msize
]:
time-lag for a given repeating sub-period, Line-conected points following a colorbar and time-values
[Nlag]: number of time steps as lag
[period]: period to be repeated allover the time-data
[colorbar]: name of the color bar to use ('auto' for rainbow)
[cbarfmt]: format of the numbers in the colorbar
[cbaror]: orientation of the colorbar ('auto' for vertical)
[ltype]: type of the lines (single value for the same, or 'auto')
[lsize]: width of the lines (single value for the same, or 'auto')
[mtype]: type of the markers (single value for the same, or 'auto')
[msize]: size of the markers (single value for the same, or 'auto')
'shadTline',[Nlag],[colorbar],[cbarfmt],[cbaror],[ltype],[lwidth],[mtype],[msize]: Line-conected
points following a colorbar and time-values
[Nlag]: number of time steps as lag
[colorbar]: name of the color bar to use ('auto' for rainbow)
[cbarfmt]: format of the numbers in the colorbar
[cbaror]: orientation of the colorbar ('auto' for vertical)
[ltype]: type of the lines (single value for the same, or 'auto')
[lsize]: width of the lines (single value for the same, or 'auto')
[mtype]: type of the markers (single value for the same, or 'auto')
[msize]: size of the markers (single value for the same, or 'auto')
'simplepts',[Nlag],[col],[type],[size]: Simple points assuming that values have all the same times
[Nlag]: number of time steps as lag
[col]: '@' list of colors of the points (single value for the same, or 'auto')
[type]:types of the points (single value for the same, or 'auto')
[size]: sizes of the points kind of lag-time figure (single value for the same, or 'auto')
labels= list of labels for legend (None for no legend, and 'None' for no specific label)
[graphtit]: title of the figure '!' for spaces
[legvalues]=[locleg]|[fontsize]:
[locleg]: location of the legend (0, autmoatic)
1: 'upper right', 2: 'upper left', 3: 'lower left', 4: 'lower right',
5: 'right', 6: 'center left', 7: 'center right', 8: 'lower center',
9: 'upper center', 10: 'center'
[fontsize]: font size for the legend (auto for 12)
[kindfig]: kind of output figure (png, pdf, ps)
[fign]: name of the figure (without extension)
[close]: whether figure should be close or not
* Plotting with cloud of points seasonal time-lag
$ python ${pyHOME}/drawing.py -o draw_time_lag -f 'Forcing_rainstats_OKstomate_CRUNCEP_spinup_SESA_seasmean_anom.nc;time_centered,0@-9@4;time_centered;rainanom%DiPolo_evapstats_OKstomate_CRUNCEP_SESA_seasmean_anom.nc;time_centered,0@-9@4;time_centered;evapanom#Forcing_rainstats_OKstomate_CRUNCEP_spinup_SESA_seasmean_anom.nc;time_centered,1@-9@4;time_centered;rainanom%DiPolo_evapstats_OKstomate_CRUNCEP_SESA_seasmean_anom.nc;time_centered,1@-9@4;time_centered;evapanom#Forcing_rainstats_OKstomate_CRUNCEP_spinup_SESA_seasmean_anom.nc;time_centered,2@-9@4;time_centered;rainanom%DiPolo_evapstats_OKstomate_CRUNCEP_SESA_seasmean_anom.nc;time_centered,2@-9@4;time_centered;evapanom#Forcing_rainstats_OKstomate_CRUNCEP_spinup_SESA_seasmean_anom.nc;time_centered,3@-9@4;time_centered;rainanom%DiPolo_evapstats_OKstomate_CRUNCEP_SESA_seasmean_anom.nc;time_centered,3@-9@4;time_centered;evapanom' -S 'auto;centered;pr;mm/d;evap;mm/d;extremescentered;extremescentered;year|seconds!since!1958-01-01!00:00:00|exct,5,y|%Y;DJF,MAM,JJA,SON;simplepts,1,#AA0000@#0000AA@#00AA00@#AAAA00,x,2.;1-seas!time-lag!at!SESA!between!pr!&!evap!;0|12;png;seas1_timelag_pr-evap_SESA_anom;yes'
* Plotting with connected lines
$ python ${pyHOME}/drawing.py -o draw_time_lag -f 'Forcing_rainstats_OKstomate_SESA_norm_meanstd_stat2.nc;time_centered,-1;time_counter;rainnorm%DiPolo_evapstats_SESA_norm_meanstd_OKstomate.nc;time_counter,-1|stats,2;time_counter;evapnorm#Forcing_rainstats_OKstomate_SACZ_norm_meanstd_stat2.nc;time_centered,-1;time_counter;rainnorm%DiPolo_evapstats_SACZ_norm_meanstd_OKstomate.nc;time_counter,-1|stats,2;time_counter;evapnorm' -S 'auto;centered;pr;1;evap;1;-5,5;-2,2;year|seconds!since!1958-01-01!00:00:00|exct,5,y|%Y;SESA,SACZ;shadTline,1,spectral,%s,horizontal,-@-.,2.,x,2.;6-month!time-lag!at!SACZ!between!pr!&!evap!normalized!by!mean/stddev;0|12;png;mon6_timelag_pr-evap_SACZ_shadline;yes'
* Plotting with grouped lines
$ python ${pyHOME}/drawing.py -o draw_time_lag -f 'Forcing_rainstats_OKstomate_SESA_norm_meanstd_stat2.nc;time_counter,0@63@1;time_counter;rainnorm%DiPolo_evapstats_SESA_norm_meanstd_OKstomate.nc;time_counter,0@63@1|stats,2;time_counter;evapnorm#Forcing_rainstats_OKstomate_SACZ_norm_meanstd_stat2.nc;time_counter,0@63@1;time_counter;rainnorm%DiPolo_evapstats_SACZ_norm_meanstd_OKstomate.nc;time_counter,0@63@1|stats,2;time_counter;evapnorm' -S 'auto;centered;pr;1;evap;1;-2.2,5;-2,2;year|seconds!since!1958-01-01!00:00:00|exct,1,y|%Y;SESA,SACZ;repeatPeriod,1,12,spectral,%s,horizontal,-@-.,2.,x,2.;1-month!time-lag!at!SACZ!between!pr!&!evap!normalized!by!mean/stddev;0|12;png;mon1_timelag_pr-evap_SACZ_repeatPeriod;yes'