4

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.

Arkistarvh Kltzuonstev
  • 6,824
  • 7
  • 26
  • 56
BBUSH
  • 49
  • 3
  • 1
    Curious about this myself. I'm experiencing the same issue on one system, running Ubuntu 18.0.4 and Python3.7.5, while the same files are opened without error on my Mac running Python3.7.7; both systems have the same netCDF4 and h5py packages installed. It's been vexing. – Titus Jun 29 '20 at 06:39

0 Answers0