%matplotlib inline
import pandas as pd
import socket
host = socket.getfqdn()
from core import load, zoom, calc, save,plots,monitor
#reload funcs after updating ./core/*.py
import importlib
importlib.reload(load)
importlib.reload(zoom)
importlib.reload(calc)
importlib.reload(save)
importlib.reload(plots)
importlib.reload(monitor)
<module 'core.monitor' from '/ccc/work/cont003/gen7420/odakatin/monitor-sedna/notebook/core/monitor.py'>
If you submit the job with job scheduler; below are list of enviroment variable one can pass
local : if True run dask local cluster, if not true, put number of workers setted in the 'local' if no 'local ' given, local will be setted automatically to 'True'
%env ychunk='2', #%env tchunk='2'
controls chunk. 'False' sets no modification from original netcdf file's chunk.
ychunk=10 will group the original netcdf file to 10 by 10
tchunk=1 will chunk the time coordinate one by one
%env file_exp=
'file_exp': Which 'experiment' name is it? this corresopnds to intake catalog name without path and .yaml
#%env year=
for Validation, this correspoinds to path/year/month 's year for monitoring, this corresponids to 'date' having means do all files in the monitoring directory setting it as 0[0-9] &1[0-9]& [2-3][0-9], the job can be separated in three lots. For DELTA experiment, year corresponds to really 'year'
%env month=
for monitoring this corresponds to file path path-XIOS.{month}/
For DELTA experiment, year corresponds to really 'month'
proceed saving? True or False , Default is setted as True
proceed plotting? True or False , Default is setted as True
proceed computation? or just load computed result? True or False , Default is setted as True
save output file used for plotting
using kerchunked file -> False, not using kerhcunk -> True
name of control file to be used for computation/plots/save/ We have number of M_xxx.csv
Monitor.sh calls M_MLD_2D
and AWTD.sh, Fluxnet.sh, Siconc.sh, IceClim.sh, FWC_SSH.sh, Integrals.sh , Sections.sh
M_AWTMD
M_Fluxnet
M_Ice_quantities
M_IceClim M_IceConce M_IceThick
M_FWC_2D M_FWC_integrals M_FWC_SSH M_SSH_anomaly
M_Mean_temp_velo M_Mooring
M_Sectionx M_Sectiony
%%time
# 'savefig': Do we save output in html? or not. keep it true.
savefig=True
client,cluster,control,catalog_url,month,year,daskreport,outputpath = load.set_control(host)
!mkdir -p $outputpath
!mkdir -p $daskreport
client
local True using host= irene4505.c-irene.mg1.tgcc.ccc.cea.fr starting dask cluster on local= True workers 16 10000000000 rome local cluster starting This code is running on irene4505.c-irene.mg1.tgcc.ccc.cea.fr using SEDNA_DELTA_MONITOR file experiment, read from ../lib/SEDNA_DELTA_MONITOR.yaml on year= 2012 on month= 04 outputpath= ../results/SEDNA_DELTA_MONITOR/ daskreport= ../results/dask/6462413irene4505.c-irene.mg1.tgcc.ccc.cea.fr_SEDNA_DELTA_MONITOR_04M_FWC_integrals/ CPU times: user 552 ms, sys: 116 ms, total: 668 ms Wall time: 20.7 s
Client-e3ea3d35-180e-11ed-81db-080038b9331f
Connection method: Cluster object | Cluster type: distributed.LocalCluster |
Dashboard: http://127.0.0.1:8787/status |
4b67d98f
Dashboard: http://127.0.0.1:8787/status | Workers: 16 |
Total threads: 128 | Total memory: 251.06 GiB |
Status: running | Using processes: True |
Scheduler-958d8bcd-dd63-4d2c-8e15-be1cc3db0ae8
Comm: tcp://127.0.0.1:36116 | Workers: 16 |
Dashboard: http://127.0.0.1:8787/status | Total threads: 128 |
Started: Just now | Total memory: 251.06 GiB |
Comm: tcp://127.0.0.1:37189 | Total threads: 8 |
Dashboard: http://127.0.0.1:37102/status | Memory: 15.69 GiB |
Nanny: tcp://127.0.0.1:34461 | |
Local directory: /tmp/dask-worker-space/worker-zmi31jr5 |
Comm: tcp://127.0.0.1:37088 | Total threads: 8 |
Dashboard: http://127.0.0.1:45563/status | Memory: 15.69 GiB |
Nanny: tcp://127.0.0.1:36117 | |
Local directory: /tmp/dask-worker-space/worker-b3ovm8ad |
Comm: tcp://127.0.0.1:35092 | Total threads: 8 |
Dashboard: http://127.0.0.1:46809/status | Memory: 15.69 GiB |
Nanny: tcp://127.0.0.1:33216 | |
Local directory: /tmp/dask-worker-space/worker-e2q97lh1 |
Comm: tcp://127.0.0.1:44400 | Total threads: 8 |
Dashboard: http://127.0.0.1:46323/status | Memory: 15.69 GiB |
Nanny: tcp://127.0.0.1:46374 | |
Local directory: /tmp/dask-worker-space/worker-90xcmdhb |
Comm: tcp://127.0.0.1:44929 | Total threads: 8 |
Dashboard: http://127.0.0.1:39943/status | Memory: 15.69 GiB |
Nanny: tcp://127.0.0.1:36944 | |
Local directory: /tmp/dask-worker-space/worker-_7zsrzo_ |
Comm: tcp://127.0.0.1:35617 | Total threads: 8 |
Dashboard: http://127.0.0.1:41533/status | Memory: 15.69 GiB |
Nanny: tcp://127.0.0.1:41230 | |
Local directory: /tmp/dask-worker-space/worker-yargw6xw |
Comm: tcp://127.0.0.1:32955 | Total threads: 8 |
Dashboard: http://127.0.0.1:36550/status | Memory: 15.69 GiB |
Nanny: tcp://127.0.0.1:43899 | |
Local directory: /tmp/dask-worker-space/worker-gfocqf3h |
Comm: tcp://127.0.0.1:44994 | Total threads: 8 |
Dashboard: http://127.0.0.1:41757/status | Memory: 15.69 GiB |
Nanny: tcp://127.0.0.1:44819 | |
Local directory: /tmp/dask-worker-space/worker-rsu5s_ws |
Comm: tcp://127.0.0.1:44187 | Total threads: 8 |
Dashboard: http://127.0.0.1:34402/status | Memory: 15.69 GiB |
Nanny: tcp://127.0.0.1:32814 | |
Local directory: /tmp/dask-worker-space/worker-dqd27o_t |
Comm: tcp://127.0.0.1:35742 | Total threads: 8 |
Dashboard: http://127.0.0.1:36907/status | Memory: 15.69 GiB |
Nanny: tcp://127.0.0.1:44120 | |
Local directory: /tmp/dask-worker-space/worker-o2sopgee |
Comm: tcp://127.0.0.1:33785 | Total threads: 8 |
Dashboard: http://127.0.0.1:33478/status | Memory: 15.69 GiB |
Nanny: tcp://127.0.0.1:36478 | |
Local directory: /tmp/dask-worker-space/worker-bod80765 |
Comm: tcp://127.0.0.1:34559 | Total threads: 8 |
Dashboard: http://127.0.0.1:33503/status | Memory: 15.69 GiB |
Nanny: tcp://127.0.0.1:45602 | |
Local directory: /tmp/dask-worker-space/worker-cgwmiczc |
Comm: tcp://127.0.0.1:35898 | Total threads: 8 |
Dashboard: http://127.0.0.1:38612/status | Memory: 15.69 GiB |
Nanny: tcp://127.0.0.1:40571 | |
Local directory: /tmp/dask-worker-space/worker-40ljxp8o |
Comm: tcp://127.0.0.1:41405 | Total threads: 8 |
Dashboard: http://127.0.0.1:42825/status | Memory: 15.69 GiB |
Nanny: tcp://127.0.0.1:44799 | |
Local directory: /tmp/dask-worker-space/worker-h793748y |
Comm: tcp://127.0.0.1:41128 | Total threads: 8 |
Dashboard: http://127.0.0.1:41550/status | Memory: 15.69 GiB |
Nanny: tcp://127.0.0.1:43744 | |
Local directory: /tmp/dask-worker-space/worker-y3kd9mc5 |
Comm: tcp://127.0.0.1:45381 | Total threads: 8 |
Dashboard: http://127.0.0.1:40850/status | Memory: 15.69 GiB |
Nanny: tcp://127.0.0.1:44350 | |
Local directory: /tmp/dask-worker-space/worker-_tsyk9sn |
df=load.controlfile(control)
#Take out 'later' tagged computations
#df=df[~df['Value'].str.contains('later')]
df
Value | Inputs | Equation | Zone | Plot | Colourmap | MinMax | Unit | Oldname | Unnamed: 10 | |
---|---|---|---|---|---|---|---|---|---|---|
FWC_integrals | calc.FWC_load_integrals(data,nc_outputpath) | BBFG | FWC_integrals | (12000,24000) | Km^3 | I-1 |
Each computation consists of
%%time
import os
calcswitch=os.environ.get('calc', 'True')
lazy=os.environ.get('lazy','False' )
loaddata=((df.Inputs != '').any())
print('calcswitch=',calcswitch,'df.Inputs != nothing',loaddata, 'lazy=',lazy)
data = load.datas(catalog_url,df.Inputs,month,year,daskreport,lazy=lazy) if ((calcswitch=='True' )*loaddata) else 0
data
calcswitch= False df.Inputs != nothing False lazy= False CPU times: user 346 µs, sys: 0 ns, total: 346 µs Wall time: 344 µs
0
%%time
monitor.auto(df,data,savefig,daskreport,outputpath,file_exp='SEDNA'
)
#calc= False #save= False #plot= True Value='FWC_integrals' Zone='BBFG' Plot='FWC_integrals' cmap='' clabel='Km^3' clim= (12000, 24000) outputpath='../results/SEDNA_DELTA_MONITOR/' nc_outputpath='../nc_results/SEDNA_DELTA_MONITOR/' filename='SEDNA_FWC_integrals_BBFG_FWC_integrals' #3 no computing , loading starts data=save.load_data(plot=Plot,path=nc_outputpath,filename=filename) start saving data load 1Dnc file from ../nc_results/SEDNA_DELTA_MONITOR/../*/SEDNA_FWC_integrals_BBFG_FWC_integrals*.nc load computed data completed
<xarray.Dataset> Dimensions: (t: 61) Coordinates: time_centered (t) object dask.array<chunksize=(61,), meta=np.ndarray> * t (t) object 2012-03-01 12:00:00 ... 2012-04-30 12:00:00 Data variables: FWC_Arctic (t) float64 dask.array<chunksize=(61,), meta=np.ndarray> FWC_CRF (t) float64 dask.array<chunksize=(61,), meta=np.ndarray>
#5 Plotting filename= plots.FWC_integrals(data,path=outputpath,filename=filename,save=savefig,cmap=cmap,clim=clim,clabel=clabel) title SEDNA_FWC_integrals_BBFG_FWC_integrals
--------------------------------------------------------------------------- UFuncTypeError Traceback (most recent call last) File <timed eval>:1, in <module> File /ccc/work/cont003/gen7420/odakatin/monitor-sedna/notebook/core/monitor.py:98, in auto(df, val, savefig, daskreport, outputpath, file_exp) 96 print('filename=',command ) 97 with performance_report(filename=daskreport+"_plot_"+step.Value+".html"): ---> 98 filename=eval(command ) 99 print(filename,'created') 100 display(IFrame(filename, width=1000, height=500)) File <string>:1, in <module> File /ccc/work/cont003/gen7420/odakatin/monitor-sedna/notebook/core/plots.py:342, in FWC_integrals(data, path, filename, save, cmap, clim, clabel) 340 print('title',filename) 341 if cmap=='None': cmap='gist_ncar' --> 342 plot_Arctic=data.FWC_Arctic.hvplot( 343 label='FWC_Arctic').opts(yaxis='left') 344 plot_CRF=data.FWC_CRF.hvplot( 345 label='FWC_CRF').opts( color='red',yaxis='right', hooks=[plot_secondary_lim]) 346 plot=(plot_Arctic*plot_CRF).opts(title=filename.replace('_', ' '),width=1000,show_grid=True) File /ccc/cont003/home/ra5563/ra5563/monitor/lib/python3.10/site-packages/hvplot/plotting/core.py:82, in hvPlotBase.__call__(self, x, y, kind, **kwds) 79 plot = self._get_converter(x, y, kind, **kwds)(kind, x, y) 80 return pn.panel(plot, **panel_dict) ---> 82 return self._get_converter(x, y, kind, **kwds)(kind, x, y) File /ccc/cont003/home/ra5563/ra5563/monitor/lib/python3.10/site-packages/hvplot/converter.py:1215, in HoloViewsConverter.__call__(self, kind, x, y) 1213 dataset = Dataset(data) 1214 dataset = dataset.redim(**self._redim) -> 1215 obj = method(x, y) 1216 obj._dataset = dataset 1218 if self.crs and self.project: 1219 # Apply projection before rasterizing File /ccc/cont003/home/ra5563/ra5563/monitor/lib/python3.10/site-packages/hvplot/converter.py:2065, in HoloViewsConverter.image(self, x, y, z, data) 2063 element = self._get_element('image') 2064 if self.geo: params['crs'] = self.crs -> 2065 return (element(data, [x, y], z, **params).redim(**redim) 2066 .apply(self._set_backends_opts, cur_opts=cur_opts, compat_opts=compat_opts)) File /ccc/cont003/home/ra5563/ra5563/monitor/lib/python3.10/site-packages/holoviews/element/raster.py:287, in Image.__init__(self, data, kdims, vdims, bounds, extents, xdensity, ydensity, rtol, **params) 285 if bounds is None: 286 xvals = self.dimension_values(0, False) --> 287 l, r, xdensity, _ = util.bound_range(xvals, xdensity, self._time_unit) 288 yvals = self.dimension_values(1, False) 289 b, t, ydensity, _ = util.bound_range(yvals, ydensity, self._time_unit) File /ccc/cont003/home/ra5563/ra5563/monitor/lib/python3.10/site-packages/holoviews/core/util.py:1993, in bound_range(vals, density, time_unit) 1991 if isinstance(low, datetime_types): 1992 halfd = np.timedelta64(int(round(halfd)), time_unit) -> 1993 return low-halfd, high+halfd, density, invert UFuncTypeError: ufunc 'subtract' cannot use operands with types dtype('O') and dtype('<m8[us]')