Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Weights are returned in memory instead of being written to disk #3

Merged
merged 8 commits into from
Aug 21, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 18 additions & 27 deletions doc/notebooks/Backend.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,7 @@
{
"cell_type": "code",
"execution_count": 1,
"metadata": {
"collapsed": true
},
"metadata": {},
"outputs": [],
"source": [
"import os\n",
Expand Down Expand Up @@ -53,9 +51,7 @@
{
"cell_type": "code",
"execution_count": 2,
"metadata": {
"collapsed": true
},
"metadata": {},
"outputs": [],
"source": [
"ds_in = xe.util.grid_2d(-120, 120, 0.4, # longitude range and resolution\n",
Expand Down Expand Up @@ -106,9 +102,7 @@
{
"cell_type": "code",
"execution_count": 4,
"metadata": {
"collapsed": true
},
"metadata": {},
"outputs": [],
"source": [
"grid_in = esmf_grid(lon_in.T, lat_in.T)\n",
Expand Down Expand Up @@ -159,9 +153,10 @@
"text/plain": [
" C_CONTIGUOUS : True\n",
" F_CONTIGUOUS : False\n",
" OWNDATA : False\n",
" OWNDATA : True\n",
" WRITEABLE : True\n",
" ALIGNED : True\n",
" WRITEBACKIFCOPY : False\n",
" UPDATEIFCOPY : False"
]
},
Expand All @@ -187,6 +182,7 @@
" OWNDATA : False\n",
" WRITEABLE : True\n",
" ALIGNED : True\n",
" WRITEBACKIFCOPY : False\n",
" UPDATEIFCOPY : False"
]
},
Expand All @@ -209,14 +205,12 @@
{
"cell_type": "code",
"execution_count": 8,
"metadata": {
"collapsed": true
},
"metadata": {},
"outputs": [],
"source": [
"filename = 'test_weights.nc' # weight filename\n",
"if os.path.exists(filename):\n",
" os.remove(filename) # ESMPy will crash if the file exists"
" os.remove(filename) # ESMPy will complain if the file exists"
]
},
{
Expand All @@ -235,8 +229,8 @@
"name": "stdout",
"output_type": "stream",
"text": [
"CPU times: user 7.06 s, sys: 382 ms, total: 7.44 s\n",
"Wall time: 7.57 s\n"
"CPU times: user 4.24 s, sys: 220 ms, total: 4.46 s\n",
"Wall time: 4.47 s\n"
]
}
],
Expand Down Expand Up @@ -329,8 +323,8 @@
"name": "stdout",
"output_type": "stream",
"text": [
"CPU times: user 2.35 s, sys: 662 ms, total: 3.01 s\n",
"Wall time: 3.09 s\n"
"CPU times: user 1.33 s, sys: 548 ms, total: 1.88 s\n",
"Wall time: 1.88 s\n"
]
}
],
Expand Down Expand Up @@ -359,6 +353,7 @@
" OWNDATA : False\n",
" WRITEABLE : True\n",
" ALIGNED : True\n",
" WRITEBACKIFCOPY : False\n",
" UPDATEIFCOPY : False"
]
},
Expand Down Expand Up @@ -463,8 +458,8 @@
"name": "stdout",
"output_type": "stream",
"text": [
"CPU times: user 443 ms, sys: 165 ms, total: 609 ms\n",
"Wall time: 620 ms\n"
"CPU times: user 529 ms, sys: 195 ms, total: 725 ms\n",
"Wall time: 722 ms\n"
]
}
],
Expand Down Expand Up @@ -505,9 +500,7 @@
{
"cell_type": "code",
"execution_count": 19,
"metadata": {
"collapsed": true
},
"metadata": {},
"outputs": [],
"source": [
"np.testing.assert_equal(data_out_scipy, data_out_esmpy) # exactly the same"
Expand All @@ -516,9 +509,7 @@
{
"cell_type": "code",
"execution_count": 20,
"metadata": {
"collapsed": true
},
"metadata": {},
"outputs": [],
"source": [
"os.remove(filename) # clean-up"
Expand All @@ -541,7 +532,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.6.2"
"version": "3.8.2"
},
"toc": {
"nav_menu": {},
Expand Down
Loading