Skip to content

Commit 26d3f95

Browse files
committed
Updated example_concentration, and made estimation of pixel size x,y/lon,lat more precise
1 parent 40a2176 commit 26d3f95

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

examples/example_concentration.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,13 @@
3535
ds_c.isel(time=12).number_area_concentration.plot()
3636
plt.show()
3737

38+
#%%
39+
# Plot the number concentration (number/area) for surface oil only (elements where z=0)
40+
ds_surface = ds.where(ds.z==0).traj.concentration(grid)
41+
ds_surface.isel(time=12).number_area_concentration.plot()
42+
plt.title('Concentration of elements at surface')
43+
plt.show()
44+
3845
#%%
3946
# We see that the cell area decreases slightly away from equator.
4047
# This is accounted for when calculating area/volume concentration.

trajan/traj.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1248,7 +1248,7 @@ def make_grid(self, dx, dy=None, z=None,
12481248

12491249
if self.crs.is_geographic:
12501250
# dx is given in meters, but must be converted to degrees
1251-
dy = dy / 111000
1251+
dy = dy / 111500
12521252
dx = dy / np.cos(np.radians((ymin + ymax)/2)).values
12531253
xdimname = 'lon'
12541254
ydimname = 'lat'

0 commit comments

Comments
 (0)