diff --git a/kerchunk/fits.py b/kerchunk/fits.py index 18729a9b..4e2d53de 100644 --- a/kerchunk/fits.py +++ b/kerchunk/fits.py @@ -28,8 +28,8 @@ 16: ">i2", 32: ">i4", 64: ">i8", - -32: "float32", - -64: "float64", + -32: ">f4", + -64: ">f8", } # always bigendian diff --git a/tests/test_fits.py b/tests/test_fits.py index 14ea6fc0..2ec19216 100644 --- a/tests/test_fits.py +++ b/tests/test_fits.py @@ -13,6 +13,20 @@ var = os.path.join(testdir, "variable_length_table.fits") +def test_image(): + # this one directly hits a remote server - should cache? + url = "https://fits.gsfc.nasa.gov/samples/WFPC2ASSNu5780205bx.fits" + out = kerchunk.fits.process_file(url) + m = fsspec.get_mapper("reference://", fo=out, remote_protocol="https") + g = zarr.open(m) + arr = g["PRIMARY"][:] + with fsspec.open( + "https://fits.gsfc.nasa.gov/samples/WFPC2ASSNu5780205bx.fits" + ) as f: + hdu = fits.getdata(f) + assert (hdu == arr).all() + + def test_ascii_table(): # this one directly hits a remote server - should cache? url = "https://fits.gsfc.nasa.gov/samples/WFPC2u5780205r_c0fx.fits" diff --git a/tests/test_grib.py b/tests/test_grib.py index 1cee1e7f..ac297b01 100644 --- a/tests/test_grib.py +++ b/tests/test_grib.py @@ -292,7 +292,7 @@ def test_parse_grib_idx_invalid_url(): def test_parse_grib_idx_no_file(): - with pytest.raises(FileNotFoundError): + with pytest.raises((FileNotFoundError, PermissionError)): # the url is spelled wrong parse_grib_idx( "s3://noaahrrr-bdp-pds/hrrr.20220804/conus/hrrr.t01z.wrfsfcf01.grib2",