I am trying to read in a netcdf file with Spyder(python 3.7) from the Anacondas package and I am getting the error message:
[Errno -51] NetCDF: Unknown file format: b'AMSR2-MBT_v2r0_GW1_s201907081630360_e201907081809340_c201907081825230.nc'
I've tried setting the paths using import os and such other methods. It seems like it may be trying to use the path as the filename or there may be an issue with the netCDF installation
I also tried joining AMSR2_path
to the filename as the MBT_data
variable but that didn't help.
import os
import netCDF4
#os.getcwd() #Use to check the current location
#os.chdir() #Use to change directory
AMSR2_path = os.path.join(os.getcwd()) #Returns the current working
directory
MBT_data = "AMSR2-
MBT_v2r0_GW1_s201907081630360_e201907081809340_c201907081825230.nc"
print(type(MBT_data))
data = netCDF4.Dataset(MBT_data,"r")
print(data.variables)
Here is the actual file.