Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
davidhassell opened this issue Aug 30, 2023 · 0 comments · Fixed by #269
Closed

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

davidhassell opened this issue Aug 30, 2023 · 0 comments · Fixed by #269
Labels
bug Something isn't working netCDF read Relating to reading netCDF datasets
Milestone

Comments

@davidhassell
Copy link
Contributor

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.

@davidhassell davidhassell added the bug Something isn't working label Aug 30, 2023
@davidhassell davidhassell added this to the Next release milestone Aug 30, 2023
@davidhassell davidhassell changed the title Rreading https:// netCDF files does not work Reading https:// netCDF files does not work Aug 30, 2023
@davidhassell davidhassell added the netCDF read Relating to reading netCDF datasets label Nov 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working netCDF read Relating to reading netCDF datasets
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant