From 1a3a39d05c5b3fbfcb9a6fdc3411ac3701930be0 Mon Sep 17 00:00:00 2001 From: Dongdong Tian Date: Mon, 6 Mar 2023 12:47:20 +0800 Subject: [PATCH] Do not raise a KeyError if actual_range attributes don't exist --- pygmt/datasets/load_remote_dataset.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pygmt/datasets/load_remote_dataset.py b/pygmt/datasets/load_remote_dataset.py index ea8cbb437ed..a3ea43f94b7 100644 --- a/pygmt/datasets/load_remote_dataset.py +++ b/pygmt/datasets/load_remote_dataset.py @@ -322,7 +322,7 @@ def _load_remote_dataset( # Remove the actual range because it gets outdated when indexing the grid, # which causes problems when exporting it to netCDF for usage on the # command-line. - grid.attrs.pop("actual_range") + grid.attrs.pop("actual_range", None) for coord in grid.coords: - grid[coord].attrs.pop("actual_range") + grid[coord].attrs.pop("actual_range", None) return grid