@@ -298,9 +298,24 @@ def bin_into_grid(
298
298
Dataset containing grid axes information.
299
299
300
300
??? tip
301
- The axis information can be easily obtained from a grid Dataset ( for example field data) with
301
+ The axis information can be created for example with:
302
302
```python
303
- axes_ds = fields_ds.coords
303
+ import ozzy as oz
304
+ nx = 200
305
+ ny = 150
306
+ xlims = (0.0, 30.0)
307
+ ylims = (-4.0, 4.0)
308
+ axes_ds = oz.Dataset(
309
+ coords={
310
+ "x1": oz.utils.axis_from_extent(nx, xlims),
311
+ "x2": oz.utils.axis_from_extent(ny, ylims),
312
+ },
313
+ pic_data_type = "grid")
314
+ ```
315
+ Or it can be obtained from an existing grid data object with:
316
+ ```python
317
+ # fields may be an existing Dataset or DataArray
318
+ axes_ds = fields.coords
304
319
```
305
320
306
321
??? note "Note about axis attributes"
@@ -359,10 +374,10 @@ def bin_into_grid(
359
374
# Create axes for binning
360
375
axes = oz.Dataset(
361
376
coords={
362
- "x1": np.linspace(0, 10, 101 ),
363
- "x2": np.linspace(0, 5, 51 ),
377
+ "x1": oz.utils.axis_from_extent(100, (0.0, 10.0) ),
378
+ "x2": oz.utils.axis_from_extent(50, (0.0, 5.0) ),
364
379
},
365
- attrs={" pic_data_type": "grid"}
380
+ pic_data_type = "grid",
366
381
)
367
382
368
383
# Bin particles into grid (Cartesian geometry)
0 commit comments