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
When using the tutorial script DEM.ipynb, I get an error when running the command to process the DEM with the mesh grid nodes, whilst also adjusting for coastlines. Example error is below.
I've found a work around, to adjust coastlines before including the interpolation onto the mesh, and then use the output from that to sample onto the mesh, with adjust_dem=False.
File ~/anaconda3/envs/pypos_main1/lib/python3.8/site-packages/pyposeidon/dem.py:91, in Dem.adjust(self, coastline, **kwargs)
89 if not check:
90 logger.warning("Adjusting dem failed, keeping original values\n")
---> 91 self.Dataset = self.Dataset.drop_vars("adjusted")
File ~/anaconda3/envs/pypos_main1/lib/python3.8/site-packages/xarray/core/dataset.py:4801, in Dataset._assert_all_in_dataset(self, names, virtual_okay)
4799 bad_names -= self.virtual_variables
4800 if bad_names:
-> 4801 raise ValueError(
4802 "One or more of the specified variables "
4803 "cannot be found in this dataset"
4804 )
ValueError: One or more of the specified variables cannot be found in this dataset
The text was updated successfully, but these errors were encountered:
Hello again,
When using the tutorial script DEM.ipynb, I get an error when running the command to process the DEM with the mesh grid nodes, whilst also adjusting for coastlines. Example error is below.
I've found a work around, to adjust coastlines before including the interpolation onto the mesh, and then use the output from that to sample onto the mesh, with adjust_dem=False.
Cheers,
Tom
dem = pdem.Dem(**geometry, coastlines = ne_i, dem_source=dem.Dataset, grid_x = x, grid_y = y,adjust_dem=True)
INFO:pyposeidon.dem:dem done
INFO:pyposeidon.dem:.. interpolating on mesh ..
INFO:pyposeidon.dem:.. using elevation values ..
INFO:pyposeidon.dem:dem on grid done
INFO:pyposeidon.utils.fix:adjust dem
DEBUG:pyposeidon.utils.fix:compute water and land
DEBUG:pyposeidon.utils.fix:invoke pygeos
DEBUG:pyposeidon.utils.fix:find wet and dry masks
DEBUG:pyposeidon.utils.fix:fix wet points
DEBUG:pyposeidon.utils.fix:fix dry points
DEBUG:pyposeidon.utils.fix:assemble dataset
WARNING:pyposeidon.dem:Adjusting dem failed, keeping original values
ValueError Traceback (most recent call last)
Input In [77], in <cell line: 1>()
----> 1 dem = pdem.Dem(**geometry, coastlines = ne_i, dem_source=dem.Dataset, grid_x = x, grid_y = y,adjust_dem=True)
File ~/anaconda3/envs/pypos_main1/lib/python3.8/site-packages/pyposeidon/dem.py:79, in Dem.init(self, dem_source, **kwargs)
77 logger.info("Dem already adjusted\n")
78 else:
---> 79 self.adjust(coastline)
File ~/anaconda3/envs/pypos_main1/lib/python3.8/site-packages/pyposeidon/dem.py:91, in Dem.adjust(self, coastline, **kwargs)
89 if not check:
90 logger.warning("Adjusting dem failed, keeping original values\n")
---> 91 self.Dataset = self.Dataset.drop_vars("adjusted")
File ~/anaconda3/envs/pypos_main1/lib/python3.8/site-packages/xarray/core/dataset.py:4834, in Dataset.drop_vars(self, names, errors)
4832 names = set(names)
4833 if errors == "raise":
-> 4834 self._assert_all_in_dataset(names)
4836 # GH6505
4837 other_names = set()
File ~/anaconda3/envs/pypos_main1/lib/python3.8/site-packages/xarray/core/dataset.py:4801, in Dataset._assert_all_in_dataset(self, names, virtual_okay)
4799 bad_names -= self.virtual_variables
4800 if bad_names:
-> 4801 raise ValueError(
4802 "One or more of the specified variables "
4803 "cannot be found in this dataset"
4804 )
ValueError: One or more of the specified variables cannot be found in this dataset
The text was updated successfully, but these errors were encountered: