You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: .github/ISSUE_TEMPLATE/02_bug.yaml
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -17,7 +17,7 @@ body:
17
17
- type: "textarea"
18
18
attributes:
19
19
label: "Code sample"
20
-
description: "If relevant, please provide a code example where this bug is shown as well as any error message. A [minimal, reproducible example](https://stackoverflow.com/help/minimal-reproducible-example) is preffered as it makes it much easier for developers to identify the cause of the bug. This also allows them quickly determine whether the problem is with your code or with Parcels itself. If you want support on a specific dataset, please [follow our instructions on how to share dataset metadata](https://docs.parcels-code.org/en/main/development/posting-issues.html)"
20
+
description: "If relevant, please provide a code example where this bug is shown as well as any error message. A [minimal, reproducible example](https://stackoverflow.com/help/minimal-reproducible-example) is preffered as it makes it much easier for developers to identify the cause of the bug. This also allows them quickly determine whether the problem is with your code or with Parcels itself. If you want support on a specific dataset, please [follow our instructions on how to share representative datasets](https://docs.parcels-code.org/en/main/development/posting-issues.html)"
Copy file name to clipboardExpand all lines: docs/development/posting-issues.md
+63-18Lines changed: 63 additions & 18 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -20,51 +20,96 @@ Following these templates provides structure and ensures that we have all the ne
20
20
Parcels is designed to work with a large range of input datasets.
21
21
22
22
When extending support for various input datasets, or trying to debug problems
23
-
that only occur with specific datasets, having the dataset metadata is very valuable.
23
+
that only occur with specific datasets, having access to your dataset (or a
24
+
close representation of it) is very valuable.
24
25
25
-
This metadata could include information such as:
26
+
This could include information such as:
26
27
27
28
- the nature of the array variables (e.g., via CF compliant metadata)
28
29
- descriptions about the origin of the dataset, or additional comments
29
30
- the shapes and data types of the arrays
31
+
- the grid topology (coordinates and key variables)
30
32
31
33
This also allows us to see if your metadata is broken/non-compliant with standards - where we can then suggest fixes for you (and maybe we can tell the data provider!).
32
34
Since version 4 of Parcels we rely much more on metadata to discover information about your input data.
33
35
34
-
Sharing this metadata often provides enough debugging information to solve your problem, instead of having to share a whole dataset.
36
+
Sharing a compact representation of your dataset often provides enough information to solve your problem, without having to share the full dataset (which may be very large or contain sensitive data).
35
37
36
-
Sharing dataset metadata is made easy in Parcels.
38
+
Parcels makes this easy by replacing irrelevant array data with zeros and saving the result as a compressed Zarr zip store, which is typically small enough to attach directly to a GitHub issue.
37
39
38
40
### Step 1. Users
39
41
40
42
As a user with access to your dataset, you would do:
41
43
42
44
```{code-cell}
43
-
import json
45
+
:tags: [hide-cell]
44
46
47
+
# Generate an example dataset to zip. The user would use their own.
45
48
import xarray as xr
49
+
from parcels._datasets.structured.generic import datasets
50
+
datasets['ds_2d_left'].to_netcdf("my_dataset.nc")
51
+
```
52
+
53
+
```{code-cell}
54
+
import os
55
+
56
+
import xarray as xr
57
+
import zarr
58
+
59
+
from parcels._datasets.utils import replace_arrays_with_zeros
60
+
61
+
# load your dataset
62
+
ds = xr.open_dataset("my_dataset.nc") # or xr.open_zarr(...), etc.
63
+
64
+
# Replace all data arrays with zeros, keeping coordinate metadata.
65
+
# This keeps array shapes and metadata while removing actual data.
66
+
#
67
+
# You can customise `except_for` to also retain actual values for specific variables:
68
+
# except_for='coords' — keep coordinate arrays (useful for grid topology)
69
+
# except_for=['lon', 'lat'] — keep a specific list of variables
70
+
# except_for=None — remove all arrays (useful to know about dtypes, structure, and metadata). This is the default for the function.
0 commit comments