%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= irene5255.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 irene5255.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/6419613irene5255.c-irene.mg1.tgcc.ccc.cea.fr_SEDNA_DELTA_MONITOR_04M_FWC_SSH/ CPU times: user 470 ms, sys: 110 ms, total: 581 ms Wall time: 20.5 s
Client-ce3b3531-13ec-11ed-83c3-080038b93f83
Connection method: Cluster object | Cluster type: distributed.LocalCluster |
Dashboard: http://127.0.0.1:8787/status |
799f0302
Dashboard: http://127.0.0.1:8787/status | Workers: 16 |
Total threads: 128 | Total memory: 251.06 GiB |
Status: running | Using processes: True |
Scheduler-01c0b0a0-83a2-4c31-b647-8d0c6be2107f
Comm: tcp://127.0.0.1:39131 | 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:46855 | Total threads: 8 |
Dashboard: http://127.0.0.1:42845/status | Memory: 15.69 GiB |
Nanny: tcp://127.0.0.1:41562 | |
Local directory: /tmp/dask-worker-space/worker-lvgslve1 |
Comm: tcp://127.0.0.1:46829 | Total threads: 8 |
Dashboard: http://127.0.0.1:37397/status | Memory: 15.69 GiB |
Nanny: tcp://127.0.0.1:38488 | |
Local directory: /tmp/dask-worker-space/worker-1i10cq81 |
Comm: tcp://127.0.0.1:41497 | Total threads: 8 |
Dashboard: http://127.0.0.1:44590/status | Memory: 15.69 GiB |
Nanny: tcp://127.0.0.1:35628 | |
Local directory: /tmp/dask-worker-space/worker-ppfum4fi |
Comm: tcp://127.0.0.1:38077 | Total threads: 8 |
Dashboard: http://127.0.0.1:39600/status | Memory: 15.69 GiB |
Nanny: tcp://127.0.0.1:36375 | |
Local directory: /tmp/dask-worker-space/worker-huk6tqfw |
Comm: tcp://127.0.0.1:43681 | Total threads: 8 |
Dashboard: http://127.0.0.1:35586/status | Memory: 15.69 GiB |
Nanny: tcp://127.0.0.1:42612 | |
Local directory: /tmp/dask-worker-space/worker-wro4_y_j |
Comm: tcp://127.0.0.1:34802 | Total threads: 8 |
Dashboard: http://127.0.0.1:45093/status | Memory: 15.69 GiB |
Nanny: tcp://127.0.0.1:38735 | |
Local directory: /tmp/dask-worker-space/worker-vxogqy7w |
Comm: tcp://127.0.0.1:43480 | Total threads: 8 |
Dashboard: http://127.0.0.1:35903/status | Memory: 15.69 GiB |
Nanny: tcp://127.0.0.1:41271 | |
Local directory: /tmp/dask-worker-space/worker-fiui1f5b |
Comm: tcp://127.0.0.1:41984 | Total threads: 8 |
Dashboard: http://127.0.0.1:46811/status | Memory: 15.69 GiB |
Nanny: tcp://127.0.0.1:37830 | |
Local directory: /tmp/dask-worker-space/worker-u6excdzp |
Comm: tcp://127.0.0.1:33838 | Total threads: 8 |
Dashboard: http://127.0.0.1:38989/status | Memory: 15.69 GiB |
Nanny: tcp://127.0.0.1:38940 | |
Local directory: /tmp/dask-worker-space/worker-pge2f6qt |
Comm: tcp://127.0.0.1:41227 | Total threads: 8 |
Dashboard: http://127.0.0.1:37077/status | Memory: 15.69 GiB |
Nanny: tcp://127.0.0.1:43523 | |
Local directory: /tmp/dask-worker-space/worker-jou7wutb |
Comm: tcp://127.0.0.1:41581 | Total threads: 8 |
Dashboard: http://127.0.0.1:35737/status | Memory: 15.69 GiB |
Nanny: tcp://127.0.0.1:37017 | |
Local directory: /tmp/dask-worker-space/worker-50g5gcqy |
Comm: tcp://127.0.0.1:46736 | Total threads: 8 |
Dashboard: http://127.0.0.1:45105/status | Memory: 15.69 GiB |
Nanny: tcp://127.0.0.1:41362 | |
Local directory: /tmp/dask-worker-space/worker-w2ecluyi |
Comm: tcp://127.0.0.1:33774 | Total threads: 8 |
Dashboard: http://127.0.0.1:43641/status | Memory: 15.69 GiB |
Nanny: tcp://127.0.0.1:45842 | |
Local directory: /tmp/dask-worker-space/worker-z79cdch6 |
Comm: tcp://127.0.0.1:45817 | Total threads: 8 |
Dashboard: http://127.0.0.1:39137/status | Memory: 15.69 GiB |
Nanny: tcp://127.0.0.1:39633 | |
Local directory: /tmp/dask-worker-space/worker-13ygenv0 |
Comm: tcp://127.0.0.1:37991 | Total threads: 8 |
Dashboard: http://127.0.0.1:33216/status | Memory: 15.69 GiB |
Nanny: tcp://127.0.0.1:34770 | |
Local directory: /tmp/dask-worker-space/worker-199mp4kq |
Comm: tcp://127.0.0.1:43195 | Total threads: 8 |
Dashboard: http://127.0.0.1:40650/status | Memory: 15.69 GiB |
Nanny: tcp://127.0.0.1:36279 | |
Local directory: /tmp/dask-worker-space/worker-iwsf2sur |
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_SSH | calc.FWC_SSH_load(data,nc_outputpath) | BBFG | FWC_SSH | None | None | m | S-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= True df.Inputs != nothing False lazy= False CPU times: user 0 ns, sys: 340 µs, total: 340 µs Wall time: 331 µs
0
%%time
monitor.auto(df,data,savefig,daskreport,outputpath,file_exp='SEDNA'
)
#calc= True #save= False #plot= True Value='FWC_SSH' Zone='BBFG' Plot='FWC_SSH' cmap='None' clabel='m' clim= None outputpath='../results/SEDNA_DELTA_MONITOR/' nc_outputpath='../nc_results/SEDNA_DELTA_MONITOR/' filename='SEDNA_FWC_SSH_BBFG_FWC_SSH' #3 Start computing data= calc.FWC_SSH_load(data,nc_outputpath) monitor.optimize_dataset(data) start saving data filename= ../nc_results/SEDNA_DELTA_MONITOR/SEDNA_maps_ALL_SSH_anomaly/t_*/y_*/x_*.nc
--------------------------------------------------------------------------- OSError Traceback (most recent call last) File <timed eval>:1, in <module> File /ccc/work/cont003/gen7420/odakatin/monitor-sedna/notebook/core/monitor.py:67, in auto(df, val, savefig, daskreport, outputpath, file_exp) 65 #print('count:',data.count()) 66 with performance_report(filename=daskreport+"_calc_"+step.Value+".html"): ---> 67 data=eval(command) 68 #print('persist ') 69 #data=data.persist() 70 print('add optimise here once otimise can recognise') File <string>:1, in <module> File /ccc/work/cont003/gen7420/odakatin/monitor-sedna/notebook/core/calc.py:222, in FWC_SSH_load(data, nc_outputpath) 220 import xarray as xr 221 filename='SEDNA_maps_ALL_SSH_anomaly' --> 222 ds=zoom.BBFG(save.load_data(plot='map',path=nc_outputpath,filename=filename)) 223 #ds=save.load_data(plot='map',path=nc_outputpath,filename=filename) 224 filename='SEDNA_maps_BBFG_FWC_2D' File /ccc/work/cont003/gen7420/odakatin/monitor-sedna/notebook/core/save.py:38, in load_data(plot, path, filename) 36 data=load_twoD(path,filename,nested=False) 37 else: ---> 38 data=load_twoD(path,filename) 39 print('load computed data completed') 40 return data File /ccc/work/cont003/gen7420/odakatin/monitor-sedna/notebook/core/save.py:48, in load_twoD(path, filename, nested) 46 dim=('x','y','t') if nested else ('t') 47 print ('filename=',filename) ---> 48 return xr.open_mfdataset(filename,parallel=True 49 ,compat='override' 50 ,data_vars='minimal' 51 ,concat_dim=dim 52 ,combine='nested' #param_xios 53 ,coords='minimal') File /ccc/cont003/home/ra5563/ra5563/monitor/lib/python3.10/site-packages/xarray/backends/api.py:937, in open_mfdataset(paths, chunks, concat_dim, compat, preprocess, engine, data_vars, coords, combine, parallel, join, attrs_file, combine_attrs, **kwargs) 934 paths = [os.fspath(p) if isinstance(p, os.PathLike) else p for p in paths] 936 if not paths: --> 937 raise OSError("no files to open") 939 if combine == "nested": 940 if isinstance(concat_dim, (str, DataArray)) or concat_dim is None: OSError: no files to open