File tree Expand file tree Collapse file tree 3 files changed +16
-2
lines changed
Expand file tree Collapse file tree 3 files changed +16
-2
lines changed Original file line number Diff line number Diff line change 11version 3.15.4
22--------------
33
4- **2023-?? -?? **
4+ **2023-10 -?? **
55
66* Record dimension coordinate cell characteristics
77 (https://github.com/NCAS-CMS/cf-python/issues/692)
@@ -10,6 +10,10 @@ version 3.15.4
1010 1-d constructs whose axis is not in the data, even when the
1111 criterion was not matched
1212 (https://github.com/NCAS-CMS/cf-python/issues/691)
13+ * Fix bug that prevented "https://" netCDF files from being read
14+ (https://github.com/NCAS-CMS/cf-python/issues/699)
15+
16+ ----
1317
1418version 3.15.3
1519--------------
Original file line number Diff line number Diff line change 55from numbers import Integral
66from os .path import isdir
77from re import Pattern
8+ from urllib .parse import urlparse
89
910from cfdm import is_log_level_info
1011from numpy .ma .core import MaskError
@@ -883,7 +884,8 @@ def read(
883884 # Expand variables
884885 file_glob = os .path .expanduser (os .path .expandvars (file_glob ))
885886
886- if file_glob .startswith ("http://" ):
887+ scheme = urlparse (file_glob ).scheme
888+ if scheme in ("https" , "http" ):
887889 # Do not glob a URL
888890 files2 = (file_glob ,)
889891 else :
Original file line number Diff line number Diff line change @@ -917,6 +917,14 @@ def test_write_omit_data(self):
917917 self .assertFalse (g .array .count ())
918918 self .assertTrue (g .construct ("grid_latitude" ).array .count ())
919919
920+ def test_read_url (self ):
921+ """Test reading urls."""
922+ for scheme in ("http" , "https" ):
923+ remote = f"{ scheme } ://psl.noaa.gov/thredds/dodsC/Datasets/cru/crutem5/Monthlies/air.mon.anom.nobs.nc"
924+ # Check that cf can access it
925+ f = cf .read (remote )
926+ self .assertEqual (len (f ), 1 )
927+
920928
921929if __name__ == "__main__" :
922930 print ("Run date:" , datetime .datetime .now ())
You can’t perform that action at this time.
0 commit comments