I have a NetCDF file from which I want to access the contents of a variable “wavelengths.” The structure of the file is somewhat like this:
Groups
Dataset: /Users/arpitasen/Desktop/Sanghavi/Data/EMIT_L2A_RFL_001_20220903T163129_2224611_012.nc
Group: sensor_band_parameters
Variables
wavelengths (285)
Datatype: Union{Missing, Float32} (Float32)
Dimensions: bands
Attributes:
_FillValue = -9999.0
long_name = Wavelength Centers
units = nm
I am trying to access the variable using the following code:
using NCDatasets
nc_file_path = "file.nc"
ncfile = NCDataset(nc_file_path, "r")
wv = ncfile["wavelengths"]
I am getting the following error, which is weird. What exactly is going on here?:
ERROR: LoadError: NetCDF error: Variable 'wavelengths' not found in file