I try to create a script to simulate tides with your project but raise this error:
Traceback (most recent call last):
File "/usr/local/lib/python3.10/dist-packages/xarray/core/dataset.py", line 1339, in _construct_dataarray
variable = self._variables[name]
KeyError: 'lon_z'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/orionx/Insync/[email protected]/Google Drive/gravimetria/tpxo-tide-prediction/exemplo_tpxo.py", line 10, in <module>
tide = tide_predict('/usr/local/lib/python3.10/dist-packages/tpxo_tide_prediction', lat, lon, times)
File "/usr/local/lib/python3.10/dist-packages/tpxo_tide_prediction/predict_tide.py", line 155, in tide_predict
h = read_h_netCDFs(paths_h, lat, lon, constituents, method=method)
File "/usr/local/lib/python3.10/dist-packages/tpxo_tide_prediction/utils.py", line 723, in read_h_netCDFs
lat_subset, lon_subset = subset_region(h, lat, lon, offset=offset)
File "/usr/local/lib/python3.10/dist-packages/tpxo_tide_prediction/utils.py", line 507, in subset_region
idx_max = ds[coords_lon].size - 1
File "/usr/local/lib/python3.10/dist-packages/xarray/core/dataset.py", line 1430, in __getitem__
return self._construct_dataarray(key)
File "/usr/local/lib/python3.10/dist-packages/xarray/core/dataset.py", line 1341, in _construct_dataarray
_, name, variable = _get_virtual_variable(self._variables, name, self.dims)
File "/usr/local/lib/python3.10/dist-packages/xarray/core/dataset.py", line 177, in _get_virtual_variable
raise KeyError(key)
KeyError: 'lon_z'
To understand what I'm doing wrong, I try to run a basic command-line example, and this error was raise:
orionx@unknown03293843927:~/Downloads/tpxo-tide-prediction$ predict_tide ./data examples/params_constant-lat_constant-lon_time.txt
Traceback (most recent call last):
File "/usr/local/lib/python3.10/dist-packages/xarray/core/dataset.py", line 1339, in _construct_dataarray
variable = self._variables[name]
KeyError: 'lon_z'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/bin/predict_tide", line 33, in <module>
sys.exit(load_entry_point('tpxo-tide-prediction==0.2.3', 'console_scripts', 'predict_tide')())
File "/usr/local/lib/python3.10/dist-packages/tpxo_tide_prediction/predict_tide.py", line 386, in main
tide = tide_predict(args.model_dir, lat, lon, times, args.constituents,
File "/usr/local/lib/python3.10/dist-packages/tpxo_tide_prediction/predict_tide.py", line 155, in tide_predict
h = read_h_netCDFs(paths_h, lat, lon, constituents, method=method)
File "/usr/local/lib/python3.10/dist-packages/tpxo_tide_prediction/utils.py", line 723, in read_h_netCDFs
lat_subset, lon_subset = subset_region(h, lat, lon, offset=offset)
File "/usr/local/lib/python3.10/dist-packages/tpxo_tide_prediction/utils.py", line 507, in subset_region
idx_max = ds[coords_lon].size - 1
File "/usr/local/lib/python3.10/dist-packages/xarray/core/dataset.py", line 1430, in __getitem__
return self._construct_dataarray(key)
File "/usr/local/lib/python3.10/dist-packages/xarray/core/dataset.py", line 1341, in _construct_dataarray
_, name, variable = _get_virtual_variable(self._variables, name, self.dims)
File "/usr/local/lib/python3.10/dist-packages/xarray/core/dataset.py", line 177, in _get_virtual_variable
raise KeyError(key)
KeyError: 'lon_z'