Skip to content

Commit

Permalink
Merge pull request #134 from FESOM/workbench
Browse files Browse the repository at this point in the history
Workbench
  • Loading branch information
patrickscholz committed Aug 2, 2024
2 parents efd6f44 + 9c24dc3 commit 91aff03
Show file tree
Hide file tree
Showing 4 changed files with 480 additions and 481 deletions.
141 changes: 64 additions & 77 deletions templates_notebooks/template_transp_hbstreamf.ipynb

Large diffs are not rendered by default.

65 changes: 26 additions & 39 deletions templates_notebooks/template_transp_mhflx.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,14 @@
"cells": [
{
"cell_type": "code",
"execution_count": 16,
"execution_count": 1,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"The autoreload extension is already loaded. To reload it, use:\n",
" %reload_ext autoreload\n"
"/albedo/home/pscholz/tripyview\n"
]
}
],
Expand Down Expand Up @@ -41,7 +40,7 @@
},
{
"cell_type": "code",
"execution_count": 17,
"execution_count": 2,
"metadata": {
"tags": [
"parameters"
Expand Down Expand Up @@ -169,7 +168,7 @@
},
{
"cell_type": "code",
"execution_count": 18,
"execution_count": 3,
"metadata": {},
"outputs": [
{
Expand All @@ -178,19 +177,6 @@
"text": [
" --> memory_limit: 2.778 GB\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"/albedo/home/pscholz/.conda/envs/py38/lib/python3.8/site-packages/distributed/node.py:169: ResourceWarning: unclosed <socket.socket fd=447, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=6, laddr=('0.0.0.0', 0)>\n",
" raise\n",
"ResourceWarning: Enable tracemalloc to get the object allocation traceback\n",
"/albedo/home/pscholz/.conda/envs/py38/lib/python3.8/site-packages/distributed/node.py:182: UserWarning: Port 8787 is already in use.\n",
"Perhaps you already have a cluster running?\n",
"Hosting the HTTP server on port 33667 instead\n",
" warnings.warn(\n"
]
}
],
"source": [
Expand All @@ -207,7 +193,7 @@
},
{
"cell_type": "code",
"execution_count": 19,
"execution_count": 4,
"metadata": {},
"outputs": [
{
Expand Down Expand Up @@ -301,7 +287,7 @@
},
{
"cell_type": "code",
"execution_count": 20,
"execution_count": 5,
"metadata": {},
"outputs": [
{
Expand All @@ -315,9 +301,9 @@
" edges (n2, edg_n) int32 0 0 0 1 1 ... 126830 126832 126856 126857\n",
" edge_tri (n2, edg_n) int32 0 3 1 2 6 5 4 7 6 ... -1 -1 -1 -1 -1 -1 -1 -1\n",
" edge_y (n2, edg_n) float32 -77.94 -77.94 -77.94 ... -77.98 -78.02\n",
" edge_dx_lr (n2, edg_n) float32 -2.484e+03 -7.361e+03 -4.272e+03 ... 0.0 0.0\n",
" edge_dy_lr (n2, edg_n) float32 -5.209e+03 -867.5 8.242e+03 ... 0.0 0.0 0.0\n",
" --> elasped time: 0.05496663252512614 min.\n",
" edge_dx_lr (n2, edg_n) float32 5.209e+03 867.5 -8.242e+03 ... 0.0 0.0 0.0\n",
" edge_dy_lr (n2, edg_n) float32 -2.484e+03 -7.361e+03 -4.272e+03 ... 0.0 0.0\n",
" --> elasped time: 0.059600114822387695 min.\n",
" --> mdiag uses 0.01 Gb:\n"
]
}
Expand Down Expand Up @@ -394,12 +380,13 @@
"\n",
"#___________________________________________________________________________\n",
"set_mdiag_chunk = dict({'edg_n': mdiag.chunksizes['edg_n'], 'n2':mdiag.chunksizes['n2']})\n",
"# dx & dy of left triangle --> norm vector \n",
"mdiag = mdiag.assign(edge_dxdy_l=xr.DataArray( np.array([ mdiag.edge_cross_dxdy[1,:], \n",
" -mdiag.edge_cross_dxdy[0,:]]), dims=['n2', 'edg_n']).chunk(set_mdiag_chunk))\n",
"# dx & dy of right triangle --> norm vector \n",
"mdiag = mdiag.assign(edge_dxdy_r=xr.DataArray( np.array([-mdiag.edge_cross_dxdy[3,:], \n",
" mdiag.edge_cross_dxdy[2,:]]), dims=['n2', 'edg_n']).chunk(set_mdiag_chunk))\n",
"# dx & dy of left triangle --> cross-edge vector \n",
"mdiag = mdiag.assign(edge_dxdy_l=xr.DataArray( np.array([ mdiag.edge_cross_dxdy[0,:], \n",
" mdiag.edge_cross_dxdy[1,:]]), dims=['n2', 'edg_n']).chunk(set_mdiag_chunk))\n",
"# dx & dy of right triangle --> cross-edge vector \n",
"mdiag = mdiag.assign(edge_dxdy_r=xr.DataArray( np.array([ mdiag.edge_cross_dxdy[2,:], \n",
" mdiag.edge_cross_dxdy[3,:]]), dims=['n2', 'edg_n']).chunk(set_mdiag_chunk))\n",
"\n",
"# if boundarie edge --> right triangle doesnot exist --> therefor dx,dy is zero there\n",
"idx = mdiag.edge_tri[1,:]<0\n",
"mdiag.edge_dxdy_r[:, idx.load()]=0. \n",
Expand Down Expand Up @@ -427,7 +414,7 @@
},
{
"cell_type": "code",
"execution_count": 21,
"execution_count": 9,
"metadata": {
"scrolled": true
},
Expand All @@ -437,25 +424,25 @@
"output_type": "stream",
"text": [
"/albedo/work/projects/p_fesom/pscholz/project_TRR181/trr181_tke+idemix_jayne_bin_ck0.1/5/ TKE+IDEMIX, jayne\n",
" --> elapsed time to load, prepare u,v, temp data: 0.10 min.\n",
" --> elapsed time to load, prepare u,v, temp data: 0.06 min.\n",
" --> data_uv uses 0.09 Gb:\n",
" --> mdiag uses 0.01 Gb:\n",
" --> elapsed time to comp. merid. hflux: 0.10 min.\n",
" --> elapsed time to comp. merid. hflux: 0.04 min.\n",
"/albedo/work/projects/p_fesom/pscholz/project_TRR181/trr181_tke+idemix_nycander_bin_ck0.1/5/ TKE+IDEMIX, nycander\n",
" --> elapsed time to load, prepare u,v, temp data: 0.09 min.\n",
" --> elapsed time to load, prepare u,v, temp data: 0.06 min.\n",
" --> data_uv uses 0.09 Gb:\n",
" --> mdiag uses 0.01 Gb:\n",
" --> elapsed time to comp. merid. hflux: 0.05 min.\n",
" --> elapsed time to comp. merid. hflux: 0.04 min.\n",
"/albedo/work/projects/p_fesom/pscholz/project_TRR181/trr181_tke+idemix_stormtide_bin_ck0.1/5/ TKE+IDEMIX, stormtide\n",
" --> elapsed time to load, prepare u,v, temp data: 0.10 min.\n",
" --> elapsed time to load, prepare u,v, temp data: 0.05 min.\n",
" --> data_uv uses 0.09 Gb:\n",
" --> mdiag uses 0.01 Gb:\n",
" --> elapsed time to comp. merid. hflux: 0.05 min.\n",
"/albedo/work/projects/p_fesom/pscholz/project_TRR181/trr181_tke_ctrl_ck0.1/5/ TKE\n",
" --> elapsed time to load, prepare u,v, temp data: 0.08 min.\n",
" --> elapsed time to load, prepare u,v, temp data: 0.06 min.\n",
" --> data_uv uses 0.09 Gb:\n",
" --> mdiag uses 0.01 Gb:\n",
" --> elapsed time to comp. merid. hflux: 0.05 min.\n"
" --> elapsed time to comp. merid. hflux: 0.04 min.\n"
]
}
],
Expand Down Expand Up @@ -526,7 +513,7 @@
},
{
"cell_type": "code",
"execution_count": 22,
"execution_count": 7,
"metadata": {},
"outputs": [
{
Expand Down Expand Up @@ -587,7 +574,7 @@
},
{
"cell_type": "code",
"execution_count": 23,
"execution_count": 8,
"metadata": {},
"outputs": [],
"source": [
Expand Down
83 changes: 26 additions & 57 deletions templates_notebooks/template_transp_zhflx.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"execution_count": 9,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"/albedo/home/pscholz/tripyview\n"
"The autoreload extension is already loaded. To reload it, use:\n",
" %reload_ext autoreload\n"
]
}
],
Expand Down Expand Up @@ -40,7 +41,7 @@
},
{
"cell_type": "code",
"execution_count": 2,
"execution_count": 10,
"metadata": {
"tags": [
"parameters"
Expand Down Expand Up @@ -168,7 +169,7 @@
},
{
"cell_type": "code",
"execution_count": 3,
"execution_count": 11,
"metadata": {},
"outputs": [
{
Expand All @@ -182,9 +183,12 @@
"name": "stderr",
"output_type": "stream",
"text": [
"/albedo/home/pscholz/.conda/envs/py38/lib/python3.8/site-packages/distributed/node.py:169: ResourceWarning: unclosed <socket.socket fd=67, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=6, laddr=('0.0.0.0', 0)>\n",
" raise\n",
"ResourceWarning: Enable tracemalloc to get the object allocation traceback\n",
"/albedo/home/pscholz/.conda/envs/py38/lib/python3.8/site-packages/distributed/node.py:182: UserWarning: Port 8787 is already in use.\n",
"Perhaps you already have a cluster running?\n",
"Hosting the HTTP server on port 44901 instead\n",
"Hosting the HTTP server on port 39559 instead\n",
" warnings.warn(\n"
]
}
Expand All @@ -203,7 +207,7 @@
},
{
"cell_type": "code",
"execution_count": 4,
"execution_count": 12,
"metadata": {},
"outputs": [
{
Expand Down Expand Up @@ -297,7 +301,7 @@
},
{
"cell_type": "code",
"execution_count": 5,
"execution_count": 13,
"metadata": {},
"outputs": [
{
Expand All @@ -311,9 +315,9 @@
" edges (n2, edg_n) int32 0 0 0 1 1 ... 126830 126832 126856 126857\n",
" edge_tri (n2, edg_n) int32 0 3 1 2 6 5 4 7 6 ... -1 -1 -1 -1 -1 -1 -1 -1\n",
" edge_x (n2, edg_n) float32 -179.7 -179.7 -179.7 ... 175.3 178.5 179.4\n",
" edge_dx_lr (n2, edg_n) float32 -2.484e+03 -7.361e+03 -4.272e+03 ... 0.0 0.0\n",
" edge_dy_lr (n2, edg_n) float32 -5.209e+03 -867.5 8.242e+03 ... 0.0 0.0 0.0\n",
" --> elasped time: 0.045320435365041094 min.\n",
" edge_dx_lr (n2, edg_n) float32 5.209e+03 867.5 -8.242e+03 ... 0.0 0.0 0.0\n",
" edge_dy_lr (n2, edg_n) float32 -2.484e+03 -7.361e+03 -4.272e+03 ... 0.0 0.0\n",
" --> elasped time: 0.04526890913645427 min.\n",
" --> mdiag uses 0.01 Gb:\n"
]
}
Expand Down Expand Up @@ -390,12 +394,13 @@
"\n",
"#___________________________________________________________________________\n",
"set_mdiag_chunk = dict({'edg_n': mdiag.chunksizes['edg_n'], 'n2':mdiag.chunksizes['n2']})\n",
"# dx & dy of left triangle --> norm vector \n",
"mdiag = mdiag.assign(edge_dxdy_l=xr.DataArray( np.array([ mdiag.edge_cross_dxdy[1,:], \n",
" -mdiag.edge_cross_dxdy[0,:]]), dims=['n2', 'edg_n']).chunk(set_mdiag_chunk))\n",
"# dx & dy of right triangle --> norm vector \n",
"mdiag = mdiag.assign(edge_dxdy_r=xr.DataArray( np.array([-mdiag.edge_cross_dxdy[3,:], \n",
" mdiag.edge_cross_dxdy[2,:]]), dims=['n2', 'edg_n']).chunk(set_mdiag_chunk))\n",
"# dx & dy of left triangle --> cross-edge vector \n",
"mdiag = mdiag.assign(edge_dxdy_l=xr.DataArray( np.array([ mdiag.edge_cross_dxdy[0,:], \n",
" mdiag.edge_cross_dxdy[1,:]]), dims=['n2', 'edg_n']).chunk(set_mdiag_chunk))\n",
"# dx & dy of right triangle --> cross-edge vector \n",
"mdiag = mdiag.assign(edge_dxdy_r=xr.DataArray( np.array([ mdiag.edge_cross_dxdy[2,:], \n",
" mdiag.edge_cross_dxdy[3,:]]), dims=['n2', 'edg_n']).chunk(set_mdiag_chunk))\n",
"\n",
"# if boundarie edge --> right triangle doesnot exist --> therefor dx,dy is zero there\n",
"idx = mdiag.edge_tri[1,:]<0\n",
"mdiag.edge_dxdy_r[:, idx.load()]=0. \n",
Expand Down Expand Up @@ -423,7 +428,7 @@
},
{
"cell_type": "code",
"execution_count": 12,
"execution_count": 14,
"metadata": {
"scrolled": false
},
Expand All @@ -436,7 +441,7 @@
" --> elapsed time to load, prepare u,v, temp data: 0.06 min.\n",
" --> data_uv uses 0.09 Gb:\n",
" --> mdiag uses 0.01 Gb:\n",
" --> elapsed time to comp. zonal. hflux: 0.02 min.\n",
" --> elapsed time to comp. zonal. hflux: 0.07 min.\n",
"/albedo/work/projects/p_fesom/pscholz/project_TRR181/trr181_tke+idemix_nycander_bin_ck0.1/5/ TKE+IDEMIX, nycander\n",
" --> elapsed time to load, prepare u,v, temp data: 0.06 min.\n",
" --> data_uv uses 0.09 Gb:\n",
Expand All @@ -448,7 +453,7 @@
" --> mdiag uses 0.01 Gb:\n",
" --> elapsed time to comp. zonal. hflux: 0.02 min.\n",
"/albedo/work/projects/p_fesom/pscholz/project_TRR181/trr181_tke_ctrl_ck0.1/5/ TKE\n",
" --> elapsed time to load, prepare u,v, temp data: 0.07 min.\n",
" --> elapsed time to load, prepare u,v, temp data: 0.06 min.\n",
" --> data_uv uses 0.09 Gb:\n",
" --> mdiag uses 0.01 Gb:\n",
" --> elapsed time to comp. zonal. hflux: 0.02 min.\n"
Expand Down Expand Up @@ -522,43 +527,7 @@
},
{
"cell_type": "code",
"execution_count": 11,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"<xarray.Dataset>\n",
"Dimensions: (lon: 357)\n",
"Coordinates:\n",
" * lon (lon) float64 -178.5 -177.5 -176.5 -175.5 ... 175.5 176.5 177.5\n",
"Data variables:\n",
" zhflx (lon) float32 0.01497 -0.006162 0.02007 ... 0.03639 0.0348 0.02542\n",
"Attributes: (12/20)\n",
" FESOM_model: FESOM2\n",
" FESOM_website: fesom.de\n",
" FESOM_git_SHA: 02f7d080\n",
" FESOM_MeshPath: /albedo/work/user/pscholz/mesh_fesom...\n",
" FESOM_mesh_representative_checksum: 297ddf9c482ca68c86a979e1bd5d3c97\n",
" FESOM_ClimateDataPath: /albedo/work/projects/p_fesom/FROM-O...\n",
" ... ...\n",
" FESOM_use_floatice: 0\n",
" FESOM_whichEVP: 0\n",
" FESOM_evp_rheol_steps: 120\n",
" FESOM_visc_option: 5\n",
" FESOM_w_split: 0\n",
" proj: index+xy\n"
]
}
],
"source": [
"print(data_list[0])"
]
},
{
"cell_type": "code",
"execution_count": 13,
"execution_count": 15,
"metadata": {},
"outputs": [
{
Expand Down Expand Up @@ -619,7 +588,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 16,
"metadata": {},
"outputs": [],
"source": [
Expand Down
Loading

0 comments on commit 91aff03

Please sign in to comment.