Skip to content

Netcdf-reader can't read https-address directly #86

@bjorkqvi

Description

@bjorkqvi

The PointNetcdf-reader can't read an OPeNDAP link:

import dnora as dn
model = dn.modelrun.ModelRun(year=2022, month=11, day=1)
model.import_spectra(filename='https://thredds.met.no/thredds/dodsC/norac_wave/spec/ww3_spec.202211.nc', convention='ww3')

Area: lon: (0.0, 0.0), lat: (0.0, 0.0)
2022-11-01 00:00:00 - 2022-11-01 23:00:00

---------------------------------------------------------------------------
Trivial (PointPicker): Choosing points to import...
---------------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/janvb/Documents/pycode/dnora_v2_checks/plot_ww3_spectra_from_file.py", line 3, in <module>
    model.import_spectra(filename='https://thredds.met.no/thredds/dodsC/norac_wave/spec/ww3_spec.202211.nc', convention='ww3')
  File "/home/janvb/miniforge3/envs/dnora/lib/python3.10/site-packages/dnora/cacher/cache_decorator.py", line 58, in wrapper
    import_method(**kwargs)
  File "/home/janvb/miniforge3/envs/dnora/lib/python3.10/site-packages/dnora/modelrun/modelrun.py", line 475, in import_spectra
    self._import_data(
  File "/home/janvb/miniforge3/envs/dnora/lib/python3.10/site-packages/dnora/modelrun/modelrun.py", line 351, in _import_data
    obj = import_data(
  File "/home/janvb/miniforge3/envs/dnora/lib/python3.10/site-packages/dnora/modelrun/import_functions.py", line 49, in import_data
    inds = pick_points(
  File "/home/janvb/miniforge3/envs/dnora/lib/python3.10/site-packages/dnora/modelrun/import_functions.py", line 180, in pick_points
    available_points = reader.get_coordinates(
  File "/home/janvb/miniforge3/envs/dnora/lib/python3.10/site-packages/dnora/read/generic/generic_readers.py", line 93, in get_coordinates
    ds = xr.open_dataset(filepath[0])
IndexError: list index out of range

Expected outcome:

The readers reads all points from the file behind the OPeNDAP link

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions