Skip to content

Reading https:// netCDF files does not work #268

@davidhassell

Description

@davidhassell

At version 1.10.1.1, reading a https:// files does not work, but reading an http:// file does work:

>>> import cfdm
>>> remote = "http://psl.noaa.gov/thredds/dodsC/Datasets/cru/crutem5/Monthlies/air.mon.anom.nobs.nc"
>>> cfdm.read(remote)
[<Field: air_temperature_anomaly(time(2082), latitude(36), longitude(72)) observations>]
>>> remote = "https://psl.noaa.gov/thredds/dodsC/Datasets/cru/crutem5/Monthlies/air.mon.anom.nobs.nc"
>>> cfdm.read(remote)
--------------------------------------------------------------------------
OSError                                   Traceback (most recent call last)
Cell In[3], line 1
----> 1 f = cfdm.read(remote)

File ~/cfdm/cfdm/read_write/read.py:360, in read(filename, external, extra, verbose, warnings, warn_valid, mask, domain, _implementation)
    355     raise IOError(
    356         f"Can't determine format of file {filename} "
    357         f"generated from CDL file {cdl_filename}"
    358     )
    359 else:
--> 360     raise IOError(f"Can't determine format of file {filename}")
    362 # ----------------------------------------------------------------
    363 # Return the field or domain constructs
    364 # ----------------------------------------------------------------
    365 return fields

OSError: Can't determine format of file https://psl.noaa.gov/thredds/dodsC/Datasets/cru/crutem5/Monthlies/air.mon.anom.nobs.nc

This is due to a simple bug in cfdm.read_write.netcdf.netcdfread.is_netcdf_file. PR to follow.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingdataset readRelating to reading datasets

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions