phys201 / Hamiltonian-photonic-crystal

Build the Hamiltonian model to reproduce the band structure measured on photonic crytal
GNU General Public License v3.0
1 stars 1 forks source link

error loading data in Documentation.ipynb #18

Open jennmcguire opened 1 year ago

jennmcguire commented 1 year ago

The code cell loading data using your package (from io.py) generates an error. See below:

---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
Cell In[13], line 4
      1 #load the data file into a DataArray
      2 #must do :pip install netCDF4 
      3 import xarray as xr
----> 4 data = io.io('expdata_GM0.05.npy')

File ~\Documents\GitHub\Hamiltonian-photonic-crystal\inference\io.py:10, in io(filename)
      9 def io(filename):
---> 10     da = xr.open_dataset(filename)
     11     print(da)
     12     return da

File ~\miniconda3\envs\phys201-2023\Lib\site-packages\xarray\backends\api.py:525, in open_dataset(filename_or_obj, engine, chunks, cache, decode_cf, mask_and_scale, decode_times, decode_timedelta, use_cftime, concat_characters, decode_coords, drop_variables, inline_array, backend_kwargs, **kwargs)
    522     kwargs.update(backend_kwargs)
    524 if engine is None:
--> 525     engine = plugins.guess_engine(filename_or_obj)
    527 backend = plugins.get_backend(engine)
    529 decoders = _resolve_decoders_kwargs(
    530     decode_cf,
    531     open_backend_dataset_parameters=backend.open_dataset_parameters,
   (...)
    537     decode_coords=decode_coords,
    538 )

File ~\miniconda3\envs\phys201-2023\Lib\site-packages\xarray\backends\plugins.py:177, in guess_engine(store_spec)
    169 else:
    170     error_msg = (
    171         "found the following matches with the input file in xarray's IO "
    172         f"backends: {compatible_engines}. But their dependencies may not be installed, see:\n"
    173         "https://docs.xarray.dev/en/stable/user-guide/io.html \n"
    174         "https://docs.xarray.dev/en/stable/getting-started-guide/installing.html"
    175     )
--> 177 raise ValueError(error_msg)

ValueError: did not find a match in any of xarray's currently installed IO backends ['netcdf4', 'scipy']. Consider explicitly selecting one of the installed engines via the ``engine`` parameter, or installing additional IO dependencies, see:
https://docs.xarray.dev/en/stable/getting-started-guide/installing.html
https://docs.xarray.dev/en/stable/user-guide/io.html
fandusara commented 1 year ago

"io_data.py" is able to load both expdata and simudata. #36