Page 1 of 1

Problem reading aggregated data

PostPosted: Tue Oct 01, 2019 12:43 pm
by cgentemann
I'm following code here:
https://climate-cms.org/2019/01/18/using-opendap.html

run:
import xarray as xr
aggr_url = "https://thredds.jpl.nasa.gov/thredds/dodsC/OceanTemperature/MUR-JPL-L4-GLOB-v4.1.nc"
data = xr.open_dataset(aggr_url)

returns:
OSError: [Errno -45] NetCDF: Not a valid data type or _FillValue type mismatch: b'https://thredds.jpl.nasa.gov/thredds/dodsC/OceanTemperature/MUR-JPL-L4-GLOB-v4.1.nc'

I tried
data = xr.open_dataset(aggr_url,decode_cf=False)

returns same error as above

suggestions?
thanks, chelle

Re: Problem reading aggregated data

PostPosted: Wed Oct 02, 2019 10:50 am
by yiboj
Hi Chelle,

I am not familiar with xarray package and you may have to check your xarray installation. But please check the following code which uses popular netCDF package to read the thredds aggregated data:

Code: Select all
import numpy as np
from netCDF4 import Dataset  # http://code.google.com/p/netcdf4-python/

nc_f = 'https://thredds.jpl.nasa.gov/thredds/dodsC/OceanTemperature/MUR-JPL-L4-GLOB-v4.1.nc'
nc_fid = Dataset(nc_f, 'r')  # Dataset is the class behavior to open the file
                             # and create an instance of the ncCDF4 class

# Extract data from NetCDF file
lats = nc_fid.variables['lat'][:]  # extract/copy the data
lons = nc_fid.variables['lon'][:]
# Close original NetCDF file.
nc_fid.close()


Regards,

PODAAC DE

Re: Problem reading aggregated data

PostPosted: Wed Oct 02, 2019 11:15 am
by cgentemann
I tried this code and still get the same error.

I ran:
Code: Select all
import numpy as np
from netCDF4 import Dataset  # http://code.google.com/p/netcdf4-python/
nc_f = 'https://thredds.jpl.nasa.gov/thredds/dodsC/OceanTemperature/MUR-JPL-L4-GLOB-v4.1.nc'
nc_fid = Dataset(nc_f, 'r')  # Dataset is the class behavior to open the file
                             # and create an instance of the ncCDF4 class

# Extract data from NetCDF file
lats = nc_fid.variables['lat'][:]  # extract/copy the data
lons = nc_fid.variables['lon'][:]
# Close original NetCDF file.
nc_fid.close()
nc_fid


error:
OSError: [Errno -45] NetCDF: Not a valid data type or _FillValue type mismatch: b'https://thredds.jpl.nasa.gov/thredds/dodsC/OceanTemperature/MUR-JPL-L4-GLOB-v4.1.nc'

Re: Problem reading aggregated data

PostPosted: Wed Oct 02, 2019 11:21 am
by yiboj
Hi Chelle,

Looks like your netCDF library or netCDF package may have issue, please check your installation.

Regards,

PODAAC DE

Re: Problem reading aggregated data

PostPosted: Mon Apr 12, 2021 5:43 pm
by jimp
Can you give more specifics on the problems with the netcdf library? I'm using python (3.8.3) with netCDF4 (1.5.3) and can read Chelle's URL no problem, but I get the same error she reported when accessing the MODIS aggregation:

Code: Select all
from netCDF4 import Dataset
nc_f = 'https://thredds.jpl.nasa.gov/thredds/dodsC/ncml_aggregation/OceanTemperature/modis/aqua/11um/4km/aggregate__MODIS_AQUA_L3_SST_THERMAL_MONTHLY_4KM_DAYTIME_V2019.0.ncml'
nc_fid = Dataset(nc_f, 'r')


Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "netCDF4/_netCDF4.pyx", line 2321, in netCDF4._netCDF4.Dataset.__init__
File "netCDF4/_netCDF4.pyx", line 1885, in netCDF4._netCDF4._ensure_nc_success
OSError: [Errno -45] NetCDF: Not a valid data type or _FillValue type mismatch: b'https://thredds.jpl.nasa.gov/thredds/dodsC/ncml_aggregation/OceanTemperature/modis/aqua/11um/4km/aggregate__MODIS_AQUA_L3_SST_THERMAL_MONTHLY_4KM_DAYTIME_V2019.0.ncml'


Thanks,

Jim