Skip to content

Instantly share code, notes, and snippets.

@jbusecke
Last active May 5, 2021 20:42
Show Gist options
  • Save jbusecke/8ca165796c82829082ff7ae9c74d5a69 to your computer and use it in GitHub Desktop.
Save jbusecke/8ca165796c82829082ff7ae9c74d5a69 to your computer and use it in GitHub Desktop.
Tuning read/processing speed for Allisions model output
Display the source blob
Display the rendered blob
Raw
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Check out Allison's output\n",
"\n",
"I have tested a few things here to speed up the reading and processing. This is all run on a \n",
"\n",
"1) Set up a LocalCluster with dask.distributed (This seems to have a large impact on overall performance, depending on how you set it up, but requires tuning). It seems like setting up many workers with few threads is the way to go here, since you are IO limited.\n",
"\n",
"2) Tune the read-in options of `xr.open_mfdataset` (This is by far the easiest tune and I got a huge speedup. 27 sec vs 2+minutes).\n",
"\n",
"3) Write out the dataset (or here one variable) as [zarr store](https://zarr.readthedocs.io/en/stable/). This is a cloud optimized chunked storage format, that is really built for parallelization. (This brings huge time savings in terms of opening (its pretty much instant) and also the mean computation is a lot faster. BUT you basically do a complete copy of the data, which wastes a bunch of space). \n"
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"import pathlib\n",
"# path = '/scratch/gpfs/GEOCLIM/LRGROUP/ESM2M_502/ESM2M_1990control_C2/'\n",
"path = '/tiger/scratch/gpfs/GEOCLIM/LRGROUP/ESM2M_502/ESM2M_1990control_C2/' # for tigressdata\n",
"\n",
"path = pathlib.Path(path)"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
"import xarray as xr"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"42.4 ms ± 3 ms per loop (mean ± std. dev. of 7 runs, 1 loop each)\n"
]
}
],
"source": [
"%timeit xr.open_dataset(path.joinpath('01920101.ocean_month.nc'), use_cftime=True)"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<table style=\"border: 2px solid white;\">\n",
"<tr>\n",
"<td style=\"vertical-align: top; border: 0px solid white\">\n",
"<h3 style=\"text-align: left;\">Client</h3>\n",
"<ul style=\"text-align: left; list-style: none; margin: 0; padding: 0;\">\n",
" <li><b>Scheduler: </b>tcp://127.0.0.1:43401</li>\n",
" <li><b>Dashboard: </b><a href='http://127.0.0.1:9999/status' target='_blank'>http://127.0.0.1:9999/status</a></li>\n",
"</ul>\n",
"</td>\n",
"<td style=\"vertical-align: top; border: 0px solid white\">\n",
"<h3 style=\"text-align: left;\">Cluster</h3>\n",
"<ul style=\"text-align: left; list-style:none; margin: 0; padding: 0;\">\n",
" <li><b>Workers: </b>40</li>\n",
" <li><b>Cores: </b>80</li>\n",
" <li><b>Memory: </b>171.80 GB</li>\n",
"</ul>\n",
"</td>\n",
"</tr>\n",
"</table>"
],
"text/plain": [
"<Client: 'tcp://127.0.0.1:43401' processes=40 threads=80, memory=171.80 GB>"
]
},
"execution_count": 4,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"from distributed import Client, LocalCluster\n",
"\n",
"# This seems to work well for the nc files\n",
"mem_total = 180\n",
"workers = 40\n",
"threads = 2\n",
"cluster = LocalCluster(\n",
" dashboard_address=9009 #choose a port that is not in use.,\n",
" memory_limit=f\"{int(mem_total/workers)}GiB\",\n",
" threads_per_worker=threads,\n",
" n_workers = workers,\n",
" )\n",
"client = Client(cluster)\n",
"client"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {},
"outputs": [],
"source": [
"import pathlib\n",
"path = pathlib.Path(path)\n",
"flist = list(path.glob('*ocean_month.nc'))"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"CPU times: user 21.6 s, sys: 1.83 s, total: 23.5 s\n",
"Wall time: 27.5 s\n"
]
}
],
"source": [
"%%time\n",
"ds = xr.open_mfdataset(\n",
" flist,\n",
" concat_dim='time',\n",
" use_cftime=True,\n",
" parallel=True,\n",
" coords='minimal', # these two options should be the fastests, but check the output, \n",
" #since they are skipping some additional comparison between single netcdf files\n",
" compat=\"override\",\n",
")"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### tigercpu\n",
"~28 sec for the 40 worker/2 threads setup\n",
"\n",
"~44 sec for the 8 worker/10 threads setup\n",
"\n",
"### tigressdata\n",
"~ 28 sec for the 40 worker/2 threads setup"
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {},
"outputs": [],
"source": [
"ds = ds[['temp']] # limit the dataset to only temp"
]
},
{
"cell_type": "code",
"execution_count": 8,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"64.455016688"
]
},
"execution_count": 8,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"ds.nbytes/1e9 # size in GB"
]
},
{
"cell_type": "code",
"execution_count": 9,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"CPU times: user 10.8 s, sys: 2.6 s, total: 13.4 s\n",
"Wall time: 33.4 s\n"
]
},
{
"data": {
"text/html": [
"<div><svg style=\"position: absolute; width: 0; height: 0; overflow: hidden\">\n",
"<defs>\n",
"<symbol id=\"icon-database\" viewBox=\"0 0 32 32\">\n",
"<path d=\"M16 0c-8.837 0-16 2.239-16 5v4c0 2.761 7.163 5 16 5s16-2.239 16-5v-4c0-2.761-7.163-5-16-5z\"></path>\n",
"<path d=\"M16 17c-8.837 0-16-2.239-16-5v6c0 2.761 7.163 5 16 5s16-2.239 16-5v-6c0 2.761-7.163 5-16 5z\"></path>\n",
"<path d=\"M16 26c-8.837 0-16-2.239-16-5v6c0 2.761 7.163 5 16 5s16-2.239 16-5v-6c0 2.761-7.163 5-16 5z\"></path>\n",
"</symbol>\n",
"<symbol id=\"icon-file-text2\" viewBox=\"0 0 32 32\">\n",
"<path d=\"M28.681 7.159c-0.694-0.947-1.662-2.053-2.724-3.116s-2.169-2.030-3.116-2.724c-1.612-1.182-2.393-1.319-2.841-1.319h-15.5c-1.378 0-2.5 1.121-2.5 2.5v27c0 1.378 1.122 2.5 2.5 2.5h23c1.378 0 2.5-1.122 2.5-2.5v-19.5c0-0.448-0.137-1.23-1.319-2.841zM24.543 5.457c0.959 0.959 1.712 1.825 2.268 2.543h-4.811v-4.811c0.718 0.556 1.584 1.309 2.543 2.268zM28 29.5c0 0.271-0.229 0.5-0.5 0.5h-23c-0.271 0-0.5-0.229-0.5-0.5v-27c0-0.271 0.229-0.5 0.5-0.5 0 0 15.499-0 15.5 0v7c0 0.552 0.448 1 1 1h7v19.5z\"></path>\n",
"<path d=\"M23 26h-14c-0.552 0-1-0.448-1-1s0.448-1 1-1h14c0.552 0 1 0.448 1 1s-0.448 1-1 1z\"></path>\n",
"<path d=\"M23 22h-14c-0.552 0-1-0.448-1-1s0.448-1 1-1h14c0.552 0 1 0.448 1 1s-0.448 1-1 1z\"></path>\n",
"<path d=\"M23 18h-14c-0.552 0-1-0.448-1-1s0.448-1 1-1h14c0.552 0 1 0.448 1 1s-0.448 1-1 1z\"></path>\n",
"</symbol>\n",
"</defs>\n",
"</svg>\n",
"<style>/* CSS stylesheet for displaying xarray objects in jupyterlab.\n",
" *\n",
" */\n",
"\n",
":root {\n",
" --xr-font-color0: var(--jp-content-font-color0, rgba(0, 0, 0, 1));\n",
" --xr-font-color2: var(--jp-content-font-color2, rgba(0, 0, 0, 0.54));\n",
" --xr-font-color3: var(--jp-content-font-color3, rgba(0, 0, 0, 0.38));\n",
" --xr-border-color: var(--jp-border-color2, #e0e0e0);\n",
" --xr-disabled-color: var(--jp-layout-color3, #bdbdbd);\n",
" --xr-background-color: var(--jp-layout-color0, white);\n",
" --xr-background-color-row-even: var(--jp-layout-color1, white);\n",
" --xr-background-color-row-odd: var(--jp-layout-color2, #eeeeee);\n",
"}\n",
"\n",
"html[theme=dark],\n",
"body.vscode-dark {\n",
" --xr-font-color0: rgba(255, 255, 255, 1);\n",
" --xr-font-color2: rgba(255, 255, 255, 0.54);\n",
" --xr-font-color3: rgba(255, 255, 255, 0.38);\n",
" --xr-border-color: #1F1F1F;\n",
" --xr-disabled-color: #515151;\n",
" --xr-background-color: #111111;\n",
" --xr-background-color-row-even: #111111;\n",
" --xr-background-color-row-odd: #313131;\n",
"}\n",
"\n",
".xr-wrap {\n",
" display: block;\n",
" min-width: 300px;\n",
" max-width: 700px;\n",
"}\n",
"\n",
".xr-text-repr-fallback {\n",
" /* fallback to plain text repr when CSS is not injected (untrusted notebook) */\n",
" display: none;\n",
"}\n",
"\n",
".xr-header {\n",
" padding-top: 6px;\n",
" padding-bottom: 6px;\n",
" margin-bottom: 4px;\n",
" border-bottom: solid 1px var(--xr-border-color);\n",
"}\n",
"\n",
".xr-header > div,\n",
".xr-header > ul {\n",
" display: inline;\n",
" margin-top: 0;\n",
" margin-bottom: 0;\n",
"}\n",
"\n",
".xr-obj-type,\n",
".xr-array-name {\n",
" margin-left: 2px;\n",
" margin-right: 10px;\n",
"}\n",
"\n",
".xr-obj-type {\n",
" color: var(--xr-font-color2);\n",
"}\n",
"\n",
".xr-sections {\n",
" padding-left: 0 !important;\n",
" display: grid;\n",
" grid-template-columns: 150px auto auto 1fr 20px 20px;\n",
"}\n",
"\n",
".xr-section-item {\n",
" display: contents;\n",
"}\n",
"\n",
".xr-section-item input {\n",
" display: none;\n",
"}\n",
"\n",
".xr-section-item input + label {\n",
" color: var(--xr-disabled-color);\n",
"}\n",
"\n",
".xr-section-item input:enabled + label {\n",
" cursor: pointer;\n",
" color: var(--xr-font-color2);\n",
"}\n",
"\n",
".xr-section-item input:enabled + label:hover {\n",
" color: var(--xr-font-color0);\n",
"}\n",
"\n",
".xr-section-summary {\n",
" grid-column: 1;\n",
" color: var(--xr-font-color2);\n",
" font-weight: 500;\n",
"}\n",
"\n",
".xr-section-summary > span {\n",
" display: inline-block;\n",
" padding-left: 0.5em;\n",
"}\n",
"\n",
".xr-section-summary-in:disabled + label {\n",
" color: var(--xr-font-color2);\n",
"}\n",
"\n",
".xr-section-summary-in + label:before {\n",
" display: inline-block;\n",
" content: '►';\n",
" font-size: 11px;\n",
" width: 15px;\n",
" text-align: center;\n",
"}\n",
"\n",
".xr-section-summary-in:disabled + label:before {\n",
" color: var(--xr-disabled-color);\n",
"}\n",
"\n",
".xr-section-summary-in:checked + label:before {\n",
" content: '▼';\n",
"}\n",
"\n",
".xr-section-summary-in:checked + label > span {\n",
" display: none;\n",
"}\n",
"\n",
".xr-section-summary,\n",
".xr-section-inline-details {\n",
" padding-top: 4px;\n",
" padding-bottom: 4px;\n",
"}\n",
"\n",
".xr-section-inline-details {\n",
" grid-column: 2 / -1;\n",
"}\n",
"\n",
".xr-section-details {\n",
" display: none;\n",
" grid-column: 1 / -1;\n",
" margin-bottom: 5px;\n",
"}\n",
"\n",
".xr-section-summary-in:checked ~ .xr-section-details {\n",
" display: contents;\n",
"}\n",
"\n",
".xr-array-wrap {\n",
" grid-column: 1 / -1;\n",
" display: grid;\n",
" grid-template-columns: 20px auto;\n",
"}\n",
"\n",
".xr-array-wrap > label {\n",
" grid-column: 1;\n",
" vertical-align: top;\n",
"}\n",
"\n",
".xr-preview {\n",
" color: var(--xr-font-color3);\n",
"}\n",
"\n",
".xr-array-preview,\n",
".xr-array-data {\n",
" padding: 0 5px !important;\n",
" grid-column: 2;\n",
"}\n",
"\n",
".xr-array-data,\n",
".xr-array-in:checked ~ .xr-array-preview {\n",
" display: none;\n",
"}\n",
"\n",
".xr-array-in:checked ~ .xr-array-data,\n",
".xr-array-preview {\n",
" display: inline-block;\n",
"}\n",
"\n",
".xr-dim-list {\n",
" display: inline-block !important;\n",
" list-style: none;\n",
" padding: 0 !important;\n",
" margin: 0;\n",
"}\n",
"\n",
".xr-dim-list li {\n",
" display: inline-block;\n",
" padding: 0;\n",
" margin: 0;\n",
"}\n",
"\n",
".xr-dim-list:before {\n",
" content: '(';\n",
"}\n",
"\n",
".xr-dim-list:after {\n",
" content: ')';\n",
"}\n",
"\n",
".xr-dim-list li:not(:last-child):after {\n",
" content: ',';\n",
" padding-right: 5px;\n",
"}\n",
"\n",
".xr-has-index {\n",
" font-weight: bold;\n",
"}\n",
"\n",
".xr-var-list,\n",
".xr-var-item {\n",
" display: contents;\n",
"}\n",
"\n",
".xr-var-item > div,\n",
".xr-var-item label,\n",
".xr-var-item > .xr-var-name span {\n",
" background-color: var(--xr-background-color-row-even);\n",
" margin-bottom: 0;\n",
"}\n",
"\n",
".xr-var-item > .xr-var-name:hover span {\n",
" padding-right: 5px;\n",
"}\n",
"\n",
".xr-var-list > li:nth-child(odd) > div,\n",
".xr-var-list > li:nth-child(odd) > label,\n",
".xr-var-list > li:nth-child(odd) > .xr-var-name span {\n",
" background-color: var(--xr-background-color-row-odd);\n",
"}\n",
"\n",
".xr-var-name {\n",
" grid-column: 1;\n",
"}\n",
"\n",
".xr-var-dims {\n",
" grid-column: 2;\n",
"}\n",
"\n",
".xr-var-dtype {\n",
" grid-column: 3;\n",
" text-align: right;\n",
" color: var(--xr-font-color2);\n",
"}\n",
"\n",
".xr-var-preview {\n",
" grid-column: 4;\n",
"}\n",
"\n",
".xr-var-name,\n",
".xr-var-dims,\n",
".xr-var-dtype,\n",
".xr-preview,\n",
".xr-attrs dt {\n",
" white-space: nowrap;\n",
" overflow: hidden;\n",
" text-overflow: ellipsis;\n",
" padding-right: 10px;\n",
"}\n",
"\n",
".xr-var-name:hover,\n",
".xr-var-dims:hover,\n",
".xr-var-dtype:hover,\n",
".xr-attrs dt:hover {\n",
" overflow: visible;\n",
" width: auto;\n",
" z-index: 1;\n",
"}\n",
"\n",
".xr-var-attrs,\n",
".xr-var-data {\n",
" display: none;\n",
" background-color: var(--xr-background-color) !important;\n",
" padding-bottom: 5px !important;\n",
"}\n",
"\n",
".xr-var-attrs-in:checked ~ .xr-var-attrs,\n",
".xr-var-data-in:checked ~ .xr-var-data {\n",
" display: block;\n",
"}\n",
"\n",
".xr-var-data > table {\n",
" float: right;\n",
"}\n",
"\n",
".xr-var-name span,\n",
".xr-var-data,\n",
".xr-attrs {\n",
" padding-left: 25px !important;\n",
"}\n",
"\n",
".xr-attrs,\n",
".xr-var-attrs,\n",
".xr-var-data {\n",
" grid-column: 1 / -1;\n",
"}\n",
"\n",
"dl.xr-attrs {\n",
" padding: 0;\n",
" margin: 0;\n",
" display: grid;\n",
" grid-template-columns: 125px auto;\n",
"}\n",
"\n",
".xr-attrs dt,\n",
".xr-attrs dd {\n",
" padding: 0;\n",
" margin: 0;\n",
" float: left;\n",
" padding-right: 10px;\n",
" width: auto;\n",
"}\n",
"\n",
".xr-attrs dt {\n",
" font-weight: normal;\n",
" grid-column: 1;\n",
"}\n",
"\n",
".xr-attrs dt:hover span {\n",
" display: inline-block;\n",
" background: var(--xr-background-color);\n",
" padding-right: 10px;\n",
"}\n",
"\n",
".xr-attrs dd {\n",
" grid-column: 2;\n",
" white-space: pre-wrap;\n",
" word-break: break-all;\n",
"}\n",
"\n",
".xr-icon-database,\n",
".xr-icon-file-text2 {\n",
" display: inline-block;\n",
" vertical-align: middle;\n",
" width: 1em;\n",
" height: 1.5em !important;\n",
" stroke-width: 0;\n",
" stroke: currentColor;\n",
" fill: currentColor;\n",
"}\n",
"</style><pre class='xr-text-repr-fallback'>&lt;xarray.DataArray &#x27;temp&#x27; (st_ocean: 50, yt_ocean: 200)&gt;\n",
"array([[ nan, nan, nan, ..., 271.75415, 271.7274 ,\n",
" 271.70673],\n",
" [ nan, nan, nan, ..., 271.6843 , 271.65784,\n",
" 271.6376 ],\n",
" [ nan, nan, nan, ..., 271.63324, 271.60434,\n",
" 271.59232],\n",
" ...,\n",
" [ nan, nan, nan, ..., nan, nan,\n",
" nan],\n",
" [ nan, nan, nan, ..., nan, nan,\n",
" nan],\n",
" [ nan, nan, nan, ..., nan, nan,\n",
" nan]], dtype=float32)\n",
"Coordinates:\n",
" * yt_ocean (yt_ocean) float64 -81.5 -80.5 -79.5 -78.5 ... 86.5 87.5 88.5 89.5\n",
" * st_ocean (st_ocean) float64 5.0 15.0 25.0 ... 4.588e+03 4.95e+03 5.316e+03</pre><div class='xr-wrap' hidden><div class='xr-header'><div class='xr-obj-type'>xarray.DataArray</div><div class='xr-array-name'>'temp'</div><ul class='xr-dim-list'><li><span class='xr-has-index'>st_ocean</span>: 50</li><li><span class='xr-has-index'>yt_ocean</span>: 200</li></ul></div><ul class='xr-sections'><li class='xr-section-item'><div class='xr-array-wrap'><input id='section-8d24fcaa-4ad9-41d6-8c2d-a325de579940' class='xr-array-in' type='checkbox' checked><label for='section-8d24fcaa-4ad9-41d6-8c2d-a325de579940' title='Show/hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-array-preview xr-preview'><span>nan nan nan nan 272.3 272.3 272.4 ... nan nan nan nan nan nan nan</span></div><div class='xr-array-data'><pre>array([[ nan, nan, nan, ..., 271.75415, 271.7274 ,\n",
" 271.70673],\n",
" [ nan, nan, nan, ..., 271.6843 , 271.65784,\n",
" 271.6376 ],\n",
" [ nan, nan, nan, ..., 271.63324, 271.60434,\n",
" 271.59232],\n",
" ...,\n",
" [ nan, nan, nan, ..., nan, nan,\n",
" nan],\n",
" [ nan, nan, nan, ..., nan, nan,\n",
" nan],\n",
" [ nan, nan, nan, ..., nan, nan,\n",
" nan]], dtype=float32)</pre></div></div></li><li class='xr-section-item'><input id='section-908b846d-481b-49dd-a03d-cd9cc005433d' class='xr-section-summary-in' type='checkbox' checked><label for='section-908b846d-481b-49dd-a03d-cd9cc005433d' class='xr-section-summary' >Coordinates: <span>(2)</span></label><div class='xr-section-inline-details'></div><div class='xr-section-details'><ul class='xr-var-list'><li class='xr-var-item'><div class='xr-var-name'><span class='xr-has-index'>yt_ocean</span></div><div class='xr-var-dims'>(yt_ocean)</div><div class='xr-var-dtype'>float64</div><div class='xr-var-preview xr-preview'>-81.5 -80.5 -79.5 ... 88.5 89.5</div><input id='attrs-38edfab7-648a-47c9-9519-6c33a03de3f0' class='xr-var-attrs-in' type='checkbox' ><label for='attrs-38edfab7-648a-47c9-9519-6c33a03de3f0' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-8802efce-799d-402a-888a-51eb3d182ce1' class='xr-var-data-in' type='checkbox'><label for='data-8802efce-799d-402a-888a-51eb3d182ce1' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'><dt><span>long_name :</span></dt><dd>tcell latitude</dd><dt><span>units :</span></dt><dd>degrees_N</dd><dt><span>cartesian_axis :</span></dt><dd>Y</dd></dl></div><div class='xr-var-data'><pre>array([-81.5 , -80.5 , -79.5 , -78.5 , -77.5 , -76.5 ,\n",
" -75.5 , -74.5 , -73.5 , -72.5 , -71.5 , -70.5 ,\n",
" -69.5 , -68.5 , -67.5 , -66.5 , -65.5 , -64.5 ,\n",
" -63.5 , -62.5 , -61.5 , -60.5 , -59.5 , -58.5 ,\n",
" -57.5 , -56.5 , -55.5 , -54.5 , -53.5 , -52.5 ,\n",
" -51.5 , -50.5 , -49.5 , -48.5 , -47.5 , -46.5 ,\n",
" -45.5 , -44.5 , -43.5 , -42.5 , -41.5 , -40.5 ,\n",
" -39.5 , -38.5 , -37.5 , -36.5 , -35.5 , -34.5 ,\n",
" -33.5 , -32.5 , -31.5 , -30.5 , -29.5 , -28.501426,\n",
" -27.507105, -26.519792, -25.542121, -24.576562, -23.625377, -22.690584,\n",
" -21.773917, -20.876803, -20.000333, -19.145246, -18.311912, -17.500333,\n",
" -16.710136, -15.940584, -15.190584, -14.458711, -13.743228, -13.04212 ,\n",
" -12.353125, -11.673771, -11.001426, -10.333333, -9.666666, -9.002051,\n",
" -8.343542, -7.695041, -7.060205, -6.442354, -5.844389, -5.268724,\n",
" -4.717221, -4.191149, -3.691149, -3.217221, -2.768724, -2.344389,\n",
" -1.942354, -1.560205, -1.195041, -0.843542, -0.502051, -0.166666,\n",
" 0.166667, 0.502052, 0.843543, 1.195042, 1.560206, 1.942354,\n",
" 2.34439 , 2.768725, 3.217222, 3.69115 , 4.19115 , 4.717222,\n",
" 5.268725, 5.84439 , 6.442354, 7.060206, 7.695042, 8.343543,\n",
" 9.002052, 9.666667, 10.333334, 11.001426, 11.673772, 12.353125,\n",
" 13.042121, 13.743229, 14.458711, 15.190584, 15.940584, 16.710137,\n",
" 17.500334, 18.311913, 19.145246, 20.000334, 20.876804, 21.773918,\n",
" 22.690585, 23.625378, 24.576563, 25.542122, 26.519792, 27.507106,\n",
" 28.501427, 29.500001, 30.500001, 31.500001, 32.500001, 33.500001,\n",
" 34.500001, 35.500001, 36.500001, 37.500001, 38.500001, 39.500001,\n",
" 40.500001, 41.500001, 42.500001, 43.500001, 44.500001, 45.500001,\n",
" 46.500001, 47.500001, 48.500001, 49.500001, 50.500001, 51.500001,\n",
" 52.500001, 53.500001, 54.500001, 55.500001, 56.500001, 57.500001,\n",
" 58.500001, 59.500001, 60.500001, 61.500001, 62.500001, 63.500001,\n",
" 64.500001, 65.500001, 66.500001, 67.500001, 68.500001, 69.500001,\n",
" 70.500001, 71.500001, 72.500001, 73.500001, 74.500001, 75.500001,\n",
" 76.500001, 77.500001, 78.500001, 79.500001, 80.500001, 81.500001,\n",
" 82.500001, 83.500001, 84.500001, 85.500001, 86.500001, 87.500001,\n",
" 88.500001, 89.500001])</pre></div></li><li class='xr-var-item'><div class='xr-var-name'><span class='xr-has-index'>st_ocean</span></div><div class='xr-var-dims'>(st_ocean)</div><div class='xr-var-dtype'>float64</div><div class='xr-var-preview xr-preview'>5.0 15.0 ... 4.95e+03 5.316e+03</div><input id='attrs-86aeb554-37f6-441a-a4ce-4aa0150055a6' class='xr-var-attrs-in' type='checkbox' ><label for='attrs-86aeb554-37f6-441a-a4ce-4aa0150055a6' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-3b8755b9-b227-4008-ab78-902ce73492d5' class='xr-var-data-in' type='checkbox'><label for='data-3b8755b9-b227-4008-ab78-902ce73492d5' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'><dt><span>long_name :</span></dt><dd>tcell zstar depth</dd><dt><span>units :</span></dt><dd>meters</dd><dt><span>cartesian_axis :</span></dt><dd>Z</dd><dt><span>positive :</span></dt><dd>down</dd><dt><span>edges :</span></dt><dd>st_edges_ocean</dd></dl></div><div class='xr-var-data'><pre>array([5.000000e+00, 1.500000e+01, 2.500000e+01, 3.500000e+01, 4.500000e+01,\n",
" 5.500000e+01, 6.500000e+01, 7.500000e+01, 8.500000e+01, 9.500000e+01,\n",
" 1.050000e+02, 1.150000e+02, 1.250000e+02, 1.350000e+02, 1.450000e+02,\n",
" 1.550000e+02, 1.650000e+02, 1.750000e+02, 1.850000e+02, 1.950000e+02,\n",
" 2.050000e+02, 2.150000e+02, 2.250000e+02, 2.361228e+02, 2.506000e+02,\n",
" 2.706208e+02, 2.983049e+02, 3.356756e+02, 3.846343e+02, 4.469366e+02,\n",
" 5.241706e+02, 6.177363e+02, 7.288285e+02, 8.584215e+02, 1.007257e+03,\n",
" 1.175835e+03, 1.364406e+03, 1.572971e+03, 1.801279e+03, 2.048829e+03,\n",
" 2.314879e+03, 2.598456e+03, 2.898365e+03, 3.213206e+03, 3.541390e+03,\n",
" 3.881162e+03, 4.230621e+03, 4.587743e+03, 4.950409e+03, 5.316429e+03])</pre></div></li></ul></div></li><li class='xr-section-item'><input id='section-1fbada50-1c22-414d-b03e-2f688ac49bdf' class='xr-section-summary-in' type='checkbox' disabled ><label for='section-1fbada50-1c22-414d-b03e-2f688ac49bdf' class='xr-section-summary' title='Expand/collapse section'>Attributes: <span>(0)</span></label><div class='xr-section-inline-details'></div><div class='xr-section-details'><dl class='xr-attrs'></dl></div></li></ul></div></div>"
],
"text/plain": [
"<xarray.DataArray 'temp' (st_ocean: 50, yt_ocean: 200)>\n",
"array([[ nan, nan, nan, ..., 271.75415, 271.7274 ,\n",
" 271.70673],\n",
" [ nan, nan, nan, ..., 271.6843 , 271.65784,\n",
" 271.6376 ],\n",
" [ nan, nan, nan, ..., 271.63324, 271.60434,\n",
" 271.59232],\n",
" ...,\n",
" [ nan, nan, nan, ..., nan, nan,\n",
" nan],\n",
" [ nan, nan, nan, ..., nan, nan,\n",
" nan],\n",
" [ nan, nan, nan, ..., nan, nan,\n",
" nan]], dtype=float32)\n",
"Coordinates:\n",
" * yt_ocean (yt_ocean) float64 -81.5 -80.5 -79.5 -78.5 ... 86.5 87.5 88.5 89.5\n",
" * st_ocean (st_ocean) float64 5.0 15.0 25.0 ... 4.588e+03 4.95e+03 5.316e+03"
]
},
"execution_count": 9,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"%time ds.temp.mean(['xt_ocean', 'time']).load()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### tigercpu\n",
"~28 sec for the 40 worker/2 threads setup\n",
"\n",
"~40 sec for the 8 worker/10 threads setup\n",
"\n",
"### tigressdata\n",
"~ 33 sec for the 40 worker/2 threads setup"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Write to zarr"
]
},
{
"cell_type": "code",
"execution_count": 10,
"metadata": {},
"outputs": [],
"source": [
"# zarr_path = 'allison_readin_bug/test_ocean_month.zarr'\n",
"# ds.to_zarr(zarr_path, consolidated=True, mode='w')"
]
},
{
"cell_type": "code",
"execution_count": 11,
"metadata": {},
"outputs": [],
"source": [
"zarr_path = 'allison_readin_bug/test_ocean_month.zarr'\n",
"ds_zarr = xr.open_zarr(zarr_path)"
]
},
{
"cell_type": "code",
"execution_count": 12,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"CPU times: user 6.97 s, sys: 1.68 s, total: 8.66 s\n",
"Wall time: 19.8 s\n"
]
},
{
"data": {
"text/html": [
"<div><svg style=\"position: absolute; width: 0; height: 0; overflow: hidden\">\n",
"<defs>\n",
"<symbol id=\"icon-database\" viewBox=\"0 0 32 32\">\n",
"<path d=\"M16 0c-8.837 0-16 2.239-16 5v4c0 2.761 7.163 5 16 5s16-2.239 16-5v-4c0-2.761-7.163-5-16-5z\"></path>\n",
"<path d=\"M16 17c-8.837 0-16-2.239-16-5v6c0 2.761 7.163 5 16 5s16-2.239 16-5v-6c0 2.761-7.163 5-16 5z\"></path>\n",
"<path d=\"M16 26c-8.837 0-16-2.239-16-5v6c0 2.761 7.163 5 16 5s16-2.239 16-5v-6c0 2.761-7.163 5-16 5z\"></path>\n",
"</symbol>\n",
"<symbol id=\"icon-file-text2\" viewBox=\"0 0 32 32\">\n",
"<path d=\"M28.681 7.159c-0.694-0.947-1.662-2.053-2.724-3.116s-2.169-2.030-3.116-2.724c-1.612-1.182-2.393-1.319-2.841-1.319h-15.5c-1.378 0-2.5 1.121-2.5 2.5v27c0 1.378 1.122 2.5 2.5 2.5h23c1.378 0 2.5-1.122 2.5-2.5v-19.5c0-0.448-0.137-1.23-1.319-2.841zM24.543 5.457c0.959 0.959 1.712 1.825 2.268 2.543h-4.811v-4.811c0.718 0.556 1.584 1.309 2.543 2.268zM28 29.5c0 0.271-0.229 0.5-0.5 0.5h-23c-0.271 0-0.5-0.229-0.5-0.5v-27c0-0.271 0.229-0.5 0.5-0.5 0 0 15.499-0 15.5 0v7c0 0.552 0.448 1 1 1h7v19.5z\"></path>\n",
"<path d=\"M23 26h-14c-0.552 0-1-0.448-1-1s0.448-1 1-1h14c0.552 0 1 0.448 1 1s-0.448 1-1 1z\"></path>\n",
"<path d=\"M23 22h-14c-0.552 0-1-0.448-1-1s0.448-1 1-1h14c0.552 0 1 0.448 1 1s-0.448 1-1 1z\"></path>\n",
"<path d=\"M23 18h-14c-0.552 0-1-0.448-1-1s0.448-1 1-1h14c0.552 0 1 0.448 1 1s-0.448 1-1 1z\"></path>\n",
"</symbol>\n",
"</defs>\n",
"</svg>\n",
"<style>/* CSS stylesheet for displaying xarray objects in jupyterlab.\n",
" *\n",
" */\n",
"\n",
":root {\n",
" --xr-font-color0: var(--jp-content-font-color0, rgba(0, 0, 0, 1));\n",
" --xr-font-color2: var(--jp-content-font-color2, rgba(0, 0, 0, 0.54));\n",
" --xr-font-color3: var(--jp-content-font-color3, rgba(0, 0, 0, 0.38));\n",
" --xr-border-color: var(--jp-border-color2, #e0e0e0);\n",
" --xr-disabled-color: var(--jp-layout-color3, #bdbdbd);\n",
" --xr-background-color: var(--jp-layout-color0, white);\n",
" --xr-background-color-row-even: var(--jp-layout-color1, white);\n",
" --xr-background-color-row-odd: var(--jp-layout-color2, #eeeeee);\n",
"}\n",
"\n",
"html[theme=dark],\n",
"body.vscode-dark {\n",
" --xr-font-color0: rgba(255, 255, 255, 1);\n",
" --xr-font-color2: rgba(255, 255, 255, 0.54);\n",
" --xr-font-color3: rgba(255, 255, 255, 0.38);\n",
" --xr-border-color: #1F1F1F;\n",
" --xr-disabled-color: #515151;\n",
" --xr-background-color: #111111;\n",
" --xr-background-color-row-even: #111111;\n",
" --xr-background-color-row-odd: #313131;\n",
"}\n",
"\n",
".xr-wrap {\n",
" display: block;\n",
" min-width: 300px;\n",
" max-width: 700px;\n",
"}\n",
"\n",
".xr-text-repr-fallback {\n",
" /* fallback to plain text repr when CSS is not injected (untrusted notebook) */\n",
" display: none;\n",
"}\n",
"\n",
".xr-header {\n",
" padding-top: 6px;\n",
" padding-bottom: 6px;\n",
" margin-bottom: 4px;\n",
" border-bottom: solid 1px var(--xr-border-color);\n",
"}\n",
"\n",
".xr-header > div,\n",
".xr-header > ul {\n",
" display: inline;\n",
" margin-top: 0;\n",
" margin-bottom: 0;\n",
"}\n",
"\n",
".xr-obj-type,\n",
".xr-array-name {\n",
" margin-left: 2px;\n",
" margin-right: 10px;\n",
"}\n",
"\n",
".xr-obj-type {\n",
" color: var(--xr-font-color2);\n",
"}\n",
"\n",
".xr-sections {\n",
" padding-left: 0 !important;\n",
" display: grid;\n",
" grid-template-columns: 150px auto auto 1fr 20px 20px;\n",
"}\n",
"\n",
".xr-section-item {\n",
" display: contents;\n",
"}\n",
"\n",
".xr-section-item input {\n",
" display: none;\n",
"}\n",
"\n",
".xr-section-item input + label {\n",
" color: var(--xr-disabled-color);\n",
"}\n",
"\n",
".xr-section-item input:enabled + label {\n",
" cursor: pointer;\n",
" color: var(--xr-font-color2);\n",
"}\n",
"\n",
".xr-section-item input:enabled + label:hover {\n",
" color: var(--xr-font-color0);\n",
"}\n",
"\n",
".xr-section-summary {\n",
" grid-column: 1;\n",
" color: var(--xr-font-color2);\n",
" font-weight: 500;\n",
"}\n",
"\n",
".xr-section-summary > span {\n",
" display: inline-block;\n",
" padding-left: 0.5em;\n",
"}\n",
"\n",
".xr-section-summary-in:disabled + label {\n",
" color: var(--xr-font-color2);\n",
"}\n",
"\n",
".xr-section-summary-in + label:before {\n",
" display: inline-block;\n",
" content: '►';\n",
" font-size: 11px;\n",
" width: 15px;\n",
" text-align: center;\n",
"}\n",
"\n",
".xr-section-summary-in:disabled + label:before {\n",
" color: var(--xr-disabled-color);\n",
"}\n",
"\n",
".xr-section-summary-in:checked + label:before {\n",
" content: '▼';\n",
"}\n",
"\n",
".xr-section-summary-in:checked + label > span {\n",
" display: none;\n",
"}\n",
"\n",
".xr-section-summary,\n",
".xr-section-inline-details {\n",
" padding-top: 4px;\n",
" padding-bottom: 4px;\n",
"}\n",
"\n",
".xr-section-inline-details {\n",
" grid-column: 2 / -1;\n",
"}\n",
"\n",
".xr-section-details {\n",
" display: none;\n",
" grid-column: 1 / -1;\n",
" margin-bottom: 5px;\n",
"}\n",
"\n",
".xr-section-summary-in:checked ~ .xr-section-details {\n",
" display: contents;\n",
"}\n",
"\n",
".xr-array-wrap {\n",
" grid-column: 1 / -1;\n",
" display: grid;\n",
" grid-template-columns: 20px auto;\n",
"}\n",
"\n",
".xr-array-wrap > label {\n",
" grid-column: 1;\n",
" vertical-align: top;\n",
"}\n",
"\n",
".xr-preview {\n",
" color: var(--xr-font-color3);\n",
"}\n",
"\n",
".xr-array-preview,\n",
".xr-array-data {\n",
" padding: 0 5px !important;\n",
" grid-column: 2;\n",
"}\n",
"\n",
".xr-array-data,\n",
".xr-array-in:checked ~ .xr-array-preview {\n",
" display: none;\n",
"}\n",
"\n",
".xr-array-in:checked ~ .xr-array-data,\n",
".xr-array-preview {\n",
" display: inline-block;\n",
"}\n",
"\n",
".xr-dim-list {\n",
" display: inline-block !important;\n",
" list-style: none;\n",
" padding: 0 !important;\n",
" margin: 0;\n",
"}\n",
"\n",
".xr-dim-list li {\n",
" display: inline-block;\n",
" padding: 0;\n",
" margin: 0;\n",
"}\n",
"\n",
".xr-dim-list:before {\n",
" content: '(';\n",
"}\n",
"\n",
".xr-dim-list:after {\n",
" content: ')';\n",
"}\n",
"\n",
".xr-dim-list li:not(:last-child):after {\n",
" content: ',';\n",
" padding-right: 5px;\n",
"}\n",
"\n",
".xr-has-index {\n",
" font-weight: bold;\n",
"}\n",
"\n",
".xr-var-list,\n",
".xr-var-item {\n",
" display: contents;\n",
"}\n",
"\n",
".xr-var-item > div,\n",
".xr-var-item label,\n",
".xr-var-item > .xr-var-name span {\n",
" background-color: var(--xr-background-color-row-even);\n",
" margin-bottom: 0;\n",
"}\n",
"\n",
".xr-var-item > .xr-var-name:hover span {\n",
" padding-right: 5px;\n",
"}\n",
"\n",
".xr-var-list > li:nth-child(odd) > div,\n",
".xr-var-list > li:nth-child(odd) > label,\n",
".xr-var-list > li:nth-child(odd) > .xr-var-name span {\n",
" background-color: var(--xr-background-color-row-odd);\n",
"}\n",
"\n",
".xr-var-name {\n",
" grid-column: 1;\n",
"}\n",
"\n",
".xr-var-dims {\n",
" grid-column: 2;\n",
"}\n",
"\n",
".xr-var-dtype {\n",
" grid-column: 3;\n",
" text-align: right;\n",
" color: var(--xr-font-color2);\n",
"}\n",
"\n",
".xr-var-preview {\n",
" grid-column: 4;\n",
"}\n",
"\n",
".xr-var-name,\n",
".xr-var-dims,\n",
".xr-var-dtype,\n",
".xr-preview,\n",
".xr-attrs dt {\n",
" white-space: nowrap;\n",
" overflow: hidden;\n",
" text-overflow: ellipsis;\n",
" padding-right: 10px;\n",
"}\n",
"\n",
".xr-var-name:hover,\n",
".xr-var-dims:hover,\n",
".xr-var-dtype:hover,\n",
".xr-attrs dt:hover {\n",
" overflow: visible;\n",
" width: auto;\n",
" z-index: 1;\n",
"}\n",
"\n",
".xr-var-attrs,\n",
".xr-var-data {\n",
" display: none;\n",
" background-color: var(--xr-background-color) !important;\n",
" padding-bottom: 5px !important;\n",
"}\n",
"\n",
".xr-var-attrs-in:checked ~ .xr-var-attrs,\n",
".xr-var-data-in:checked ~ .xr-var-data {\n",
" display: block;\n",
"}\n",
"\n",
".xr-var-data > table {\n",
" float: right;\n",
"}\n",
"\n",
".xr-var-name span,\n",
".xr-var-data,\n",
".xr-attrs {\n",
" padding-left: 25px !important;\n",
"}\n",
"\n",
".xr-attrs,\n",
".xr-var-attrs,\n",
".xr-var-data {\n",
" grid-column: 1 / -1;\n",
"}\n",
"\n",
"dl.xr-attrs {\n",
" padding: 0;\n",
" margin: 0;\n",
" display: grid;\n",
" grid-template-columns: 125px auto;\n",
"}\n",
"\n",
".xr-attrs dt,\n",
".xr-attrs dd {\n",
" padding: 0;\n",
" margin: 0;\n",
" float: left;\n",
" padding-right: 10px;\n",
" width: auto;\n",
"}\n",
"\n",
".xr-attrs dt {\n",
" font-weight: normal;\n",
" grid-column: 1;\n",
"}\n",
"\n",
".xr-attrs dt:hover span {\n",
" display: inline-block;\n",
" background: var(--xr-background-color);\n",
" padding-right: 10px;\n",
"}\n",
"\n",
".xr-attrs dd {\n",
" grid-column: 2;\n",
" white-space: pre-wrap;\n",
" word-break: break-all;\n",
"}\n",
"\n",
".xr-icon-database,\n",
".xr-icon-file-text2 {\n",
" display: inline-block;\n",
" vertical-align: middle;\n",
" width: 1em;\n",
" height: 1.5em !important;\n",
" stroke-width: 0;\n",
" stroke: currentColor;\n",
" fill: currentColor;\n",
"}\n",
"</style><pre class='xr-text-repr-fallback'>&lt;xarray.DataArray &#x27;temp&#x27; (st_ocean: 50, yt_ocean: 200)&gt;\n",
"array([[ nan, nan, nan, ..., 271.75415, 271.7274 ,\n",
" 271.70673],\n",
" [ nan, nan, nan, ..., 271.6843 , 271.65784,\n",
" 271.6376 ],\n",
" [ nan, nan, nan, ..., 271.63324, 271.60434,\n",
" 271.59232],\n",
" ...,\n",
" [ nan, nan, nan, ..., nan, nan,\n",
" nan],\n",
" [ nan, nan, nan, ..., nan, nan,\n",
" nan],\n",
" [ nan, nan, nan, ..., nan, nan,\n",
" nan]], dtype=float32)\n",
"Coordinates:\n",
" * st_ocean (st_ocean) float64 5.0 15.0 25.0 ... 4.588e+03 4.95e+03 5.316e+03\n",
" * yt_ocean (yt_ocean) float64 -81.5 -80.5 -79.5 -78.5 ... 86.5 87.5 88.5 89.5</pre><div class='xr-wrap' hidden><div class='xr-header'><div class='xr-obj-type'>xarray.DataArray</div><div class='xr-array-name'>'temp'</div><ul class='xr-dim-list'><li><span class='xr-has-index'>st_ocean</span>: 50</li><li><span class='xr-has-index'>yt_ocean</span>: 200</li></ul></div><ul class='xr-sections'><li class='xr-section-item'><div class='xr-array-wrap'><input id='section-1c4999e2-eb70-4db3-a68a-467b43dcec67' class='xr-array-in' type='checkbox' checked><label for='section-1c4999e2-eb70-4db3-a68a-467b43dcec67' title='Show/hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-array-preview xr-preview'><span>nan nan nan nan 272.3 272.3 272.4 ... nan nan nan nan nan nan nan</span></div><div class='xr-array-data'><pre>array([[ nan, nan, nan, ..., 271.75415, 271.7274 ,\n",
" 271.70673],\n",
" [ nan, nan, nan, ..., 271.6843 , 271.65784,\n",
" 271.6376 ],\n",
" [ nan, nan, nan, ..., 271.63324, 271.60434,\n",
" 271.59232],\n",
" ...,\n",
" [ nan, nan, nan, ..., nan, nan,\n",
" nan],\n",
" [ nan, nan, nan, ..., nan, nan,\n",
" nan],\n",
" [ nan, nan, nan, ..., nan, nan,\n",
" nan]], dtype=float32)</pre></div></div></li><li class='xr-section-item'><input id='section-fe496130-ecc7-45a8-b884-bff07cd6966a' class='xr-section-summary-in' type='checkbox' checked><label for='section-fe496130-ecc7-45a8-b884-bff07cd6966a' class='xr-section-summary' >Coordinates: <span>(2)</span></label><div class='xr-section-inline-details'></div><div class='xr-section-details'><ul class='xr-var-list'><li class='xr-var-item'><div class='xr-var-name'><span class='xr-has-index'>st_ocean</span></div><div class='xr-var-dims'>(st_ocean)</div><div class='xr-var-dtype'>float64</div><div class='xr-var-preview xr-preview'>5.0 15.0 ... 4.95e+03 5.316e+03</div><input id='attrs-b7678198-cbf4-4c80-996f-7b0267822ea7' class='xr-var-attrs-in' type='checkbox' ><label for='attrs-b7678198-cbf4-4c80-996f-7b0267822ea7' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-6dcbfeed-4b9e-4378-a238-6929bc509b6a' class='xr-var-data-in' type='checkbox'><label for='data-6dcbfeed-4b9e-4378-a238-6929bc509b6a' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'><dt><span>cartesian_axis :</span></dt><dd>Z</dd><dt><span>edges :</span></dt><dd>st_edges_ocean</dd><dt><span>long_name :</span></dt><dd>tcell zstar depth</dd><dt><span>positive :</span></dt><dd>down</dd><dt><span>units :</span></dt><dd>meters</dd></dl></div><div class='xr-var-data'><pre>array([5.000000e+00, 1.500000e+01, 2.500000e+01, 3.500000e+01, 4.500000e+01,\n",
" 5.500000e+01, 6.500000e+01, 7.500000e+01, 8.500000e+01, 9.500000e+01,\n",
" 1.050000e+02, 1.150000e+02, 1.250000e+02, 1.350000e+02, 1.450000e+02,\n",
" 1.550000e+02, 1.650000e+02, 1.750000e+02, 1.850000e+02, 1.950000e+02,\n",
" 2.050000e+02, 2.150000e+02, 2.250000e+02, 2.361228e+02, 2.506000e+02,\n",
" 2.706208e+02, 2.983049e+02, 3.356756e+02, 3.846343e+02, 4.469366e+02,\n",
" 5.241706e+02, 6.177363e+02, 7.288285e+02, 8.584215e+02, 1.007257e+03,\n",
" 1.175835e+03, 1.364406e+03, 1.572971e+03, 1.801279e+03, 2.048829e+03,\n",
" 2.314879e+03, 2.598456e+03, 2.898365e+03, 3.213206e+03, 3.541390e+03,\n",
" 3.881162e+03, 4.230621e+03, 4.587743e+03, 4.950409e+03, 5.316429e+03])</pre></div></li><li class='xr-var-item'><div class='xr-var-name'><span class='xr-has-index'>yt_ocean</span></div><div class='xr-var-dims'>(yt_ocean)</div><div class='xr-var-dtype'>float64</div><div class='xr-var-preview xr-preview'>-81.5 -80.5 -79.5 ... 88.5 89.5</div><input id='attrs-6ba35ea8-53c4-4d17-b8f2-6879889692db' class='xr-var-attrs-in' type='checkbox' ><label for='attrs-6ba35ea8-53c4-4d17-b8f2-6879889692db' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-5846b8dc-0be1-49f5-91a6-563620907158' class='xr-var-data-in' type='checkbox'><label for='data-5846b8dc-0be1-49f5-91a6-563620907158' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'><dt><span>cartesian_axis :</span></dt><dd>Y</dd><dt><span>long_name :</span></dt><dd>tcell latitude</dd><dt><span>units :</span></dt><dd>degrees_N</dd></dl></div><div class='xr-var-data'><pre>array([-81.5 , -80.5 , -79.5 , -78.5 , -77.5 , -76.5 ,\n",
" -75.5 , -74.5 , -73.5 , -72.5 , -71.5 , -70.5 ,\n",
" -69.5 , -68.5 , -67.5 , -66.5 , -65.5 , -64.5 ,\n",
" -63.5 , -62.5 , -61.5 , -60.5 , -59.5 , -58.5 ,\n",
" -57.5 , -56.5 , -55.5 , -54.5 , -53.5 , -52.5 ,\n",
" -51.5 , -50.5 , -49.5 , -48.5 , -47.5 , -46.5 ,\n",
" -45.5 , -44.5 , -43.5 , -42.5 , -41.5 , -40.5 ,\n",
" -39.5 , -38.5 , -37.5 , -36.5 , -35.5 , -34.5 ,\n",
" -33.5 , -32.5 , -31.5 , -30.5 , -29.5 , -28.501426,\n",
" -27.507105, -26.519792, -25.542121, -24.576562, -23.625377, -22.690584,\n",
" -21.773917, -20.876803, -20.000333, -19.145246, -18.311912, -17.500333,\n",
" -16.710136, -15.940584, -15.190584, -14.458711, -13.743228, -13.04212 ,\n",
" -12.353125, -11.673771, -11.001426, -10.333333, -9.666666, -9.002051,\n",
" -8.343542, -7.695041, -7.060205, -6.442354, -5.844389, -5.268724,\n",
" -4.717221, -4.191149, -3.691149, -3.217221, -2.768724, -2.344389,\n",
" -1.942354, -1.560205, -1.195041, -0.843542, -0.502051, -0.166666,\n",
" 0.166667, 0.502052, 0.843543, 1.195042, 1.560206, 1.942354,\n",
" 2.34439 , 2.768725, 3.217222, 3.69115 , 4.19115 , 4.717222,\n",
" 5.268725, 5.84439 , 6.442354, 7.060206, 7.695042, 8.343543,\n",
" 9.002052, 9.666667, 10.333334, 11.001426, 11.673772, 12.353125,\n",
" 13.042121, 13.743229, 14.458711, 15.190584, 15.940584, 16.710137,\n",
" 17.500334, 18.311913, 19.145246, 20.000334, 20.876804, 21.773918,\n",
" 22.690585, 23.625378, 24.576563, 25.542122, 26.519792, 27.507106,\n",
" 28.501427, 29.500001, 30.500001, 31.500001, 32.500001, 33.500001,\n",
" 34.500001, 35.500001, 36.500001, 37.500001, 38.500001, 39.500001,\n",
" 40.500001, 41.500001, 42.500001, 43.500001, 44.500001, 45.500001,\n",
" 46.500001, 47.500001, 48.500001, 49.500001, 50.500001, 51.500001,\n",
" 52.500001, 53.500001, 54.500001, 55.500001, 56.500001, 57.500001,\n",
" 58.500001, 59.500001, 60.500001, 61.500001, 62.500001, 63.500001,\n",
" 64.500001, 65.500001, 66.500001, 67.500001, 68.500001, 69.500001,\n",
" 70.500001, 71.500001, 72.500001, 73.500001, 74.500001, 75.500001,\n",
" 76.500001, 77.500001, 78.500001, 79.500001, 80.500001, 81.500001,\n",
" 82.500001, 83.500001, 84.500001, 85.500001, 86.500001, 87.500001,\n",
" 88.500001, 89.500001])</pre></div></li></ul></div></li><li class='xr-section-item'><input id='section-9ff32608-95bb-4a15-80e3-efa2a136cc5d' class='xr-section-summary-in' type='checkbox' disabled ><label for='section-9ff32608-95bb-4a15-80e3-efa2a136cc5d' class='xr-section-summary' title='Expand/collapse section'>Attributes: <span>(0)</span></label><div class='xr-section-inline-details'></div><div class='xr-section-details'><dl class='xr-attrs'></dl></div></li></ul></div></div>"
],
"text/plain": [
"<xarray.DataArray 'temp' (st_ocean: 50, yt_ocean: 200)>\n",
"array([[ nan, nan, nan, ..., 271.75415, 271.7274 ,\n",
" 271.70673],\n",
" [ nan, nan, nan, ..., 271.6843 , 271.65784,\n",
" 271.6376 ],\n",
" [ nan, nan, nan, ..., 271.63324, 271.60434,\n",
" 271.59232],\n",
" ...,\n",
" [ nan, nan, nan, ..., nan, nan,\n",
" nan],\n",
" [ nan, nan, nan, ..., nan, nan,\n",
" nan],\n",
" [ nan, nan, nan, ..., nan, nan,\n",
" nan]], dtype=float32)\n",
"Coordinates:\n",
" * st_ocean (st_ocean) float64 5.0 15.0 25.0 ... 4.588e+03 4.95e+03 5.316e+03\n",
" * yt_ocean (yt_ocean) float64 -81.5 -80.5 -79.5 -78.5 ... 86.5 87.5 88.5 89.5"
]
},
"execution_count": 12,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"%time ds_zarr.temp.mean(['xt_ocean', 'time']).load()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### tigercpu\n",
"~13 sec for the 40 worker/2 threads setup\n",
"\n",
"~16 sec for the 8 worker/10 threads setup\n",
"\n",
"### tigressdata\n",
"~ 20 sec for the 40 worker/2 threads setup"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python [conda env:conda_tigressdata-aguadv_omz_busecke_2021]",
"language": "python",
"name": "conda-env-conda_tigressdata-aguadv_omz_busecke_2021-py"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.2"
}
},
"nbformat": 4,
"nbformat_minor": 4
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment