Skip to content

Commit b7faa2f

Browse files
Fourth batch of tutorial cleanups after Parcels-code#2719
1 parent 1869c75 commit b7faa2f

4 files changed

Lines changed: 15 additions & 15 deletions

File tree

docs/user_guide/examples/tutorial_gsw_density.ipynb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,8 @@
8484
"pset = parcels.ParticleSet(\n",
8585
" fieldset=fieldset,\n",
8686
" pclass=GSWParticle,\n",
87-
" lon=[32],\n",
88-
" lat=[-31],\n",
87+
" x=[32],\n",
88+
" y=[-31],\n",
8989
" z=[200],\n",
9090
")"
9191
]
@@ -108,7 +108,7 @@
108108
"def ParcelsGSW(particles, fieldset):\n",
109109
" particles.temp = fieldset.thetao[particles]\n",
110110
" particles.salt = fieldset.so[particles]\n",
111-
" pressure = gsw.p_from_z(-particles.z, particles.lat)\n",
111+
" pressure = gsw.p_from_z(-particles.z, particles.y)\n",
112112
" particles.density = gsw.density.rho(particles.salt, particles.temp, pressure)"
113113
]
114114
},

docs/user_guide/examples/tutorial_manipulating_field_data.ipynb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@
129129
"lons = np.repeat(31, npart)\n",
130130
"lats = np.linspace(-32.5, -30.5, npart)\n",
131131
"\n",
132-
"pset = parcels.ParticleSet(fieldset, pclass=parcels.Particle, z=z, lat=lats, lon=lons)\n",
132+
"pset = parcels.ParticleSet(fieldset, pclass=parcels.Particle, z=z, y=lats, x=lons)\n",
133133
"output_file = parcels.ParticleFile(\n",
134134
" path=\"summed_advection_wind.parquet\", outputdt=np.timedelta64(6, \"h\")\n",
135135
")\n",
@@ -159,14 +159,14 @@
159159
"# Plot the resulting particle trajectories overlapped for both cases\n",
160160
"summed_advection_wind = parcels.read_particlefile(\"summed_advection_wind.parquet\")\n",
161161
"for traj in summed_advection_wind.partition_by(\"particle_id\", maintain_order=True):\n",
162-
" plt.plot(traj[\"lon\"], traj[\"lat\"], \"-\")\n",
162+
" plt.plot(traj[\"x\"], traj[\"y\"], \"-\")\n",
163163
"plt.show()"
164164
]
165165
}
166166
],
167167
"metadata": {
168168
"kernelspec": {
169-
"display_name": "docs",
169+
"display_name": "Parcels:docs (3.14.6)",
170170
"language": "python",
171171
"name": "python3"
172172
},
@@ -180,7 +180,7 @@
180180
"name": "python",
181181
"nbconvert_exporter": "python",
182182
"pygments_lexer": "ipython3",
183-
"version": "3.14.4"
183+
"version": "3.14.6"
184184
}
185185
},
186186
"nbformat": 4,

docs/user_guide/examples/tutorial_mitgcm.ipynb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@
9090
" particles[any_error].state = parcels.StatusCode.Delete\n",
9191
"\n",
9292
"\n",
93-
"pset = parcels.ParticleSet(fieldset=fieldset, lon=X, lat=Y, z=Z)\n",
93+
"pset = parcels.ParticleSet(fieldset=fieldset, x=X, y=Y, z=Z)\n",
9494
"\n",
9595
"outputfile = parcels.ParticleFile(\n",
9696
" path=\"mitgcm_particles.parquet\",\n",
@@ -123,14 +123,14 @@
123123
"df = parcels.read_particlefile(\"mitgcm_particles.parquet\")\n",
124124
"\n",
125125
"for traj in df.partition_by(\"particle_id\", maintain_order=True):\n",
126-
" plt.plot(traj[\"lon\"], traj[\"lat\"], \".-\")\n",
126+
" plt.plot(traj[\"x\"], traj[\"y\"], \".-\")\n",
127127
"plt.show()"
128128
]
129129
}
130130
],
131131
"metadata": {
132132
"kernelspec": {
133-
"display_name": "docs",
133+
"display_name": "Parcels:docs (3.14.6)",
134134
"language": "python",
135135
"name": "python3"
136136
},
@@ -144,7 +144,7 @@
144144
"name": "python",
145145
"nbconvert_exporter": "python",
146146
"pygments_lexer": "ipython3",
147-
"version": "3.14.4"
147+
"version": "3.14.6"
148148
}
149149
},
150150
"nbformat": 4,

docs/user_guide/examples/tutorial_statuscodes.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ But of course, you can also write code for more sophisticated behaviour than jus
3737
```
3838
def Move1DegreeWest(particles, fieldset):
3939
out_of_bounds = particles.state == parcels.StatusCode.ErrorOutOfBounds
40-
particles[out_of_bounds].dlon -= 1.0
40+
particles[out_of_bounds].dx -= 1.0
4141
particles[out_of_bounds].state = parcels.StatusCode.Evaluate
4242
```
4343

@@ -77,15 +77,15 @@ If we advect particles with the `AdvectionRK2_3D` kernel, Parcels will raise a `
7777

7878
```{code-cell}
7979
:tags: [raises-exception]
80-
pset = parcels.ParticleSet(fieldset, parcels.Particle, z=[0.5], lat=[2], lon=[1.5])
80+
pset = parcels.ParticleSet(fieldset, parcels.Particle, z=[0.5], y=[2], x=[1.5])
8181
kernels = [parcels.kernels.AdvectionRK2_3D]
8282
pset.execute(kernels, runtime=np.timedelta64(1, "m"), dt=np.timedelta64(1, "s"), verbose_progress=False)
8383
```
8484

8585
When we add the `KeepInOcean` Kernel, particles will stay at the surface:
8686

8787
```{code-cell}
88-
pset = parcels.ParticleSet(fieldset, parcels.Particle, z=[0.5], lat=[2], lon=[1.5])
88+
pset = parcels.ParticleSet(fieldset, parcels.Particle, z=[0.5], y=[2], x=[1.5])
8989
9090
kernels = [parcels.kernels.AdvectionRK2_3D, KeepInOcean]
9191
@@ -95,5 +95,5 @@ print(f"particle z at end of run = {pset.z}")
9595
```
9696

9797
```{note}
98-
Kernels that control what to do with `particles.state` should typically be added at the _end_ of the Kernel list, because otherwise later Kernels may overwrite the `particles.state` or the `particles.dlon` variables (see [Kernel loop explanation](explanation_kernelloop.md)).
98+
Kernels that control what to do with `particles.state` should typically be added at the _end_ of the Kernel list, because otherwise later Kernels may overwrite the `particles.state` or the `particles.dx` variables (see [Kernel loop explanation](explanation_kernelloop.md)).
9999
```

0 commit comments

Comments
 (0)