|
| 1 | +--- |
| 2 | +file_format: mystnb |
| 3 | +kernelspec: |
| 4 | + name: python3 |
| 5 | +--- |
| 6 | + |
| 7 | +# Participating in the issue tracker |
| 8 | + |
| 9 | +We love hearing from our community! |
| 10 | +We want to be able to support you in your workflows, and learn about how you use Parcels. |
| 11 | +In open source projects, getting feedback from users is hard - you posting |
| 12 | +issues and participating in the issue tracker is really useful for us and |
| 13 | +helps future development and squash bugs. |
| 14 | + |
| 15 | +Parcels provides issue templates for when posting issues. |
| 16 | +Following these templates provides structure and ensures that we have all the necessary information we need to help you. |
| 17 | + |
| 18 | +## "Parcels doesn't work with my input dataset" |
| 19 | + |
| 20 | +Parcels is designed to work with a large range of input datasets. |
| 21 | + |
| 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. |
| 24 | + |
| 25 | +This metadata could include information such as: |
| 26 | + |
| 27 | +- CF compliant metadata |
| 28 | +- descriptions about the origin of the dataset, or additional comments |
| 29 | +- the shapes and data types of the arrays |
| 30 | + |
| 31 | +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 | +Since version 4 of Parcels we rely much more on metadata to discover information about your input data. |
| 33 | + |
| 34 | +Sharing this metadata often provides enough debugging information to solve your problem, instead of having to share a whole dataset. |
| 35 | + |
| 36 | +Sharing dataset metadata is made easy in Parcels. |
| 37 | + |
| 38 | +### Step 1. Users |
| 39 | + |
| 40 | +As a user with access to your dataset, you would do: |
| 41 | + |
| 42 | +```{code-cell} |
| 43 | +import json |
| 44 | +
|
| 45 | +import xarray as xr |
| 46 | +
|
| 47 | +# defining an example dataset to illustrate |
| 48 | +# (you would use `xr.open_dataset(...)` instead) |
| 49 | +ds = xr.Dataset(attrs={"description": "my dataset"}) |
| 50 | +
|
| 51 | +output_file = "my_dataset.json" |
| 52 | +with open(output_file, "w") as f: |
| 53 | + json.dump(ds.to_dict(data=False), f) # write your dataset to a JSON excluding array data |
| 54 | +``` |
| 55 | + |
| 56 | +Then attach the produced JSON file alongside your issue |
| 57 | + |
| 58 | +### Step 2. Maintainers and developers |
| 59 | + |
| 60 | +As developers looking to inspect the metadata, we would do: |
| 61 | + |
| 62 | +```{code-cell} |
| 63 | +from parcels._datasets.utils import from_xarray_dataset_dict |
| 64 | +
|
| 65 | +with open(output_file) as f: |
| 66 | + d = json.load(f) |
| 67 | +ds = from_xarray_dataset_dict(d) |
| 68 | +``` |
| 69 | + |
| 70 | +From there we can take a look the metadata of your dataset! |
0 commit comments