%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'>
# 'month': = 'JOBID' almost month but not really,
# If you submit the job with job scheduler, above
#below are list of enviroment variable one can pass
#%env local='2"
# 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 control=FWC_SSH
# name of control file to be used for computation/plots/save/
#%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.
#%env month=
# for monitoring this corresponds to file path path-XIOS.{month}/
#
#%env save= proceed saving? True or False , Default is setted as True
#%env plot= proceed plotting? True or False , Default is setted as True
#%env calc= proceed computation? or just load computed result? True or False , Default is setted as True
#%env save=False
#%env lazy=False
%%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= irene4142.c-irene.mg1.tgcc.ccc.cea.fr starting dask cluster on local= True workers 16 10000000000 False rome local cluster starting This code is running on irene4142.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= 02 outputpath= ../results/SEDNA_DELTA_MONITOR/ daskreport= ../results/dask/6414417irene4142.c-irene.mg1.tgcc.ccc.cea.fr_SEDNA_DELTA_MONITOR_02M_AWTMD/ CPU times: user 539 ms, sys: 154 ms, total: 693 ms Wall time: 21 s
Client-d2933935-1353-11ed-9ff2-080038b9322d
Connection method: Cluster object | Cluster type: distributed.LocalCluster |
Dashboard: http://127.0.0.1:8787/status |
84fa41e7
Dashboard: http://127.0.0.1:8787/status | Workers: 16 |
Total threads: 128 | Total memory: 251.06 GiB |
Status: running | Using processes: True |
Scheduler-e1934041-41af-4acc-9924-d8c0e9e823eb
Comm: tcp://127.0.0.1:34657 | 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:37131 | Total threads: 8 |
Dashboard: http://127.0.0.1:43414/status | Memory: 15.69 GiB |
Nanny: tcp://127.0.0.1:42216 | |
Local directory: /tmp/dask-worker-space/worker-tlgqlys8 |
Comm: tcp://127.0.0.1:33127 | Total threads: 8 |
Dashboard: http://127.0.0.1:39730/status | Memory: 15.69 GiB |
Nanny: tcp://127.0.0.1:38857 | |
Local directory: /tmp/dask-worker-space/worker-flrp6fvy |
Comm: tcp://127.0.0.1:38426 | Total threads: 8 |
Dashboard: http://127.0.0.1:34808/status | Memory: 15.69 GiB |
Nanny: tcp://127.0.0.1:37415 | |
Local directory: /tmp/dask-worker-space/worker-n8tg1n8w |
Comm: tcp://127.0.0.1:40959 | Total threads: 8 |
Dashboard: http://127.0.0.1:36618/status | Memory: 15.69 GiB |
Nanny: tcp://127.0.0.1:35968 | |
Local directory: /tmp/dask-worker-space/worker-75_ysmqh |
Comm: tcp://127.0.0.1:46449 | Total threads: 8 |
Dashboard: http://127.0.0.1:44704/status | Memory: 15.69 GiB |
Nanny: tcp://127.0.0.1:42609 | |
Local directory: /tmp/dask-worker-space/worker-pkxlilyt |
Comm: tcp://127.0.0.1:41031 | Total threads: 8 |
Dashboard: http://127.0.0.1:35357/status | Memory: 15.69 GiB |
Nanny: tcp://127.0.0.1:42667 | |
Local directory: /tmp/dask-worker-space/worker-_h0g8wi8 |
Comm: tcp://127.0.0.1:36681 | Total threads: 8 |
Dashboard: http://127.0.0.1:45606/status | Memory: 15.69 GiB |
Nanny: tcp://127.0.0.1:38467 | |
Local directory: /tmp/dask-worker-space/worker-4bkei62c |
Comm: tcp://127.0.0.1:38884 | Total threads: 8 |
Dashboard: http://127.0.0.1:39055/status | Memory: 15.69 GiB |
Nanny: tcp://127.0.0.1:46429 | |
Local directory: /tmp/dask-worker-space/worker-o68thhh4 |
Comm: tcp://127.0.0.1:41885 | Total threads: 8 |
Dashboard: http://127.0.0.1:45417/status | Memory: 15.69 GiB |
Nanny: tcp://127.0.0.1:33761 | |
Local directory: /tmp/dask-worker-space/worker-ta4dctm2 |
Comm: tcp://127.0.0.1:46791 | Total threads: 8 |
Dashboard: http://127.0.0.1:40704/status | Memory: 15.69 GiB |
Nanny: tcp://127.0.0.1:33299 | |
Local directory: /tmp/dask-worker-space/worker-oqt6mv7z |
Comm: tcp://127.0.0.1:42064 | Total threads: 8 |
Dashboard: http://127.0.0.1:44311/status | Memory: 15.69 GiB |
Nanny: tcp://127.0.0.1:40667 | |
Local directory: /tmp/dask-worker-space/worker-yo54xbwu |
Comm: tcp://127.0.0.1:41437 | Total threads: 8 |
Dashboard: http://127.0.0.1:33163/status | Memory: 15.69 GiB |
Nanny: tcp://127.0.0.1:40044 | |
Local directory: /tmp/dask-worker-space/worker-rfwzhsg2 |
Comm: tcp://127.0.0.1:35724 | Total threads: 8 |
Dashboard: http://127.0.0.1:38573/status | Memory: 15.69 GiB |
Nanny: tcp://127.0.0.1:36256 | |
Local directory: /tmp/dask-worker-space/worker-k7x6lvu_ |
Comm: tcp://127.0.0.1:37481 | Total threads: 8 |
Dashboard: http://127.0.0.1:33552/status | Memory: 15.69 GiB |
Nanny: tcp://127.0.0.1:38107 | |
Local directory: /tmp/dask-worker-space/worker-5i2hlqo8 |
Comm: tcp://127.0.0.1:45414 | Total threads: 8 |
Dashboard: http://127.0.0.1:37773/status | Memory: 15.69 GiB |
Nanny: tcp://127.0.0.1:34710 | |
Local directory: /tmp/dask-worker-space/worker-r8bqn8bb |
Comm: tcp://127.0.0.1:45010 | Total threads: 8 |
Dashboard: http://127.0.0.1:36994/status | Memory: 15.69 GiB |
Nanny: tcp://127.0.0.1:42638 | |
Local directory: /tmp/dask-worker-space/worker-gsz6qr5o |
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 | |
---|---|---|---|---|---|---|---|---|---|---|
AW_maxtemp_depth | gridT.votemper,gridS.vosaline,param.mask,param... | calc.AWTD4(data) | ALL | AWTD_map | jet | (0,800) | m | M-5 |
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 True lazy= False CPU times: user 472 µs, sys: 0 ns, total: 472 µs Wall time: 432 µs
0
%%time
monitor.auto(df,data,savefig,daskreport,outputpath,file_exp='SEDNA'
)
#calc= False #save= False #plot= True Value='AW_maxtemp_depth' Zone='ALL' Plot='AWTD_map' cmap='jet' clabel='m' clim= (0, 800) outputpath='../results/SEDNA_DELTA_MONITOR/' nc_outputpath='../nc_results/SEDNA_DELTA_MONITOR/' filename='SEDNA_AWTD_map_ALL_AW_maxtemp_depth' #3 no computing , loading starts dtaa=save.load_data(plot=Plot,path=nc_outputpath,filename=filename) start saving data filename= ../nc_results/SEDNA_DELTA_MONITOR/SEDNA_AWTD_map_ALL_AW_maxtemp_depth/t_*/x_*/y_*.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:76, in auto(df, val, savefig, daskreport, outputpath, file_exp) 74 print('dtaa=save.load_data(plot=Plot,path=nc_outputpath,filename=filename)' ) 75 with performance_report(filename=daskreport+"_calc_"+step.Value+".html"): ---> 76 data=save.load_data(plot=Plot,path=nc_outputpath,filename=filename) 77 #saveswitch=False 79 display(data) 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:47, in load_twoD(path, filename, nested) 45 filename=filesave+'/t_*/x_*/y_*.nc' if nested else filesave+'/t_*.nc' 46 print ('filename=',filename) ---> 47 return xr.open_mfdataset(filename,parallel=True 48 ,compat='override' 49 ,data_vars='minimal' 50 ,concat_dim=('x','y','t') 51 ,combine='nested' #param_xios 52 ,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