Skip to content

Commit 5b541c0

Browse files
Moving gsw to general import section
Also changing particle.depth to particle.z throughout, following #2303
1 parent 869f66c commit 5b541c0

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

docs/examples/tutorial_gsw_density.ipynb

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
"metadata": {},
3232
"outputs": [],
3333
"source": [
34+
"import gsw # The package to calculate density from temperature, salinity and depth\n",
3435
"import numpy as np\n",
3536
"import xarray as xr\n",
3637
"\n",
@@ -78,7 +79,7 @@
7879
" pclass=GSWParticle,\n",
7980
" lon=[32],\n",
8081
" lat=[-31],\n",
81-
" depth=[200],\n",
82+
" z=[200],\n",
8283
")"
8384
]
8485
},
@@ -98,11 +99,9 @@
9899
"outputs": [],
99100
"source": [
100101
"def ParcelsGSW(particles, fieldset):\n",
101-
" import gsw\n",
102-
"\n",
103102
" particles.temp = fieldset.thetao[particles]\n",
104103
" particles.salt = fieldset.so[particles]\n",
105-
" pressure = gsw.p_from_z(-particles.depth, particles.lat)\n",
104+
" pressure = gsw.p_from_z(-particles.z, particles.lat)\n",
106105
" particles.density = gsw.density.rho(particles.salt, particles.temp, pressure)"
107106
]
108107
},

0 commit comments

Comments
 (0)