Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding option to silence xarray decodewarnings #1208

Merged
merged 2 commits into from Aug 4, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
33 changes: 16 additions & 17 deletions parcels/examples/documentation_indexing.ipynb
Expand Up @@ -65,7 +65,11 @@
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"metadata": {
"tags": [
"raises-exception"
]
},
"outputs": [
{
"ename": "ValueError",
Expand Down Expand Up @@ -123,19 +127,7 @@
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"WARNING: File NemoNorthSeaORCA025-N006_data/coordinates.nc could not be decoded properly by xarray (version 0.15.1).\n",
" It will be opened with no decoding. Filling values might be wrongly parsed.\n",
"WARNING: Casting lon data to np.float32\n",
"WARNING: Casting lat data to np.float32\n",
"WARNING: Trying to initialize a shared grid with different chunking sizes - action prohibited. Replacing requested field_chunksize with grid's master chunksize.\n"
]
}
],
"outputs": [],
"source": [
"mesh_mask = data_path + 'coordinates.nc'\n",
"\n",
Expand All @@ -147,7 +139,14 @@
" 'V': {'lon': 'glamf', 'lat': 'gphif', 'depth': 'depthw', 'time': 'time_counter'},\n",
" 'W': {'lon': 'glamf', 'lat': 'gphif', 'depth': 'depthw', 'time': 'time_counter'}}\n",
"\n",
"fieldsetC = FieldSet.from_nemo(filenames, variables, dimensions)"
"fieldsetC = FieldSet.from_nemo(filenames, variables, dimensions, netcdf_decodewarning=False)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Note by the way, that we used `netcdf_decodewarning=False` in the `FieldSet.from_nemo()` call above. This is to silence an expected warning because the time dimension in the `coordinates.nc` file can't be decoded by `xarray`."
]
},
{
Expand Down Expand Up @@ -221,7 +220,7 @@
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
Expand All @@ -235,7 +234,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.5"
"version": "3.8.13"
}
},
"nbformat": 4,
Expand Down