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

test_get_array does not work with prism_pr_small.nc in CI #206

Open
eyvorchuk opened this issue Mar 21, 2022 · 0 comments
Open

test_get_array does not work with prism_pr_small.nc in CI #206

eyvorchuk opened this issue Mar 21, 2022 · 0 comments
Labels

Comments

@eyvorchuk
Copy link
Contributor

eyvorchuk commented Mar 21, 2022

When creating the build using the GitHub Actions CI, test_get_array in test_util.py fails when using the prism_pr_small.nc file for all polygons except no_polygon_0 with the following error:

_________________ test_get_array[haida_gwaii_6-prism_pr_small] _________________

>   ???

rasterio/_base.pyx:261: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

>   ???

rasterio/_shim.pyx:78: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

>   ???
E   rasterio._err.CPLE_OpenFailedError: NETCDF:"/github/home/.local/share/virtualenvs/climate-explorer-backend-8G2w_ODg/lib/python3.8/site-packages/ce/tests/data/prism_pr_small.nc":pr: No such file or directory

rasterio/_err.pyx:215: CPLE_OpenFailedError

During handling of the above exception, another exception occurred:

request = <FixtureRequest for <Function test_get_array[haida_gwaii_6-prism_pr_small]>>
nctuple = (<class 'netCDF4._netCDF4.Dataset'>
root group (NETCDF4 data model, file format HDF5):
    Conventions: CF-1.5
    GDA...share/virtualenvs/climate-explorer-backend-8G2w_ODg/lib/python3.8/site-packages/ce/tests/data/prism_pr_small.nc', 'pr')
polygon = 'MULTIPOLYGON(((-133.4329023938909 54.383829480227,-131.07107067594964\n            54.46520405265149,-130.32821767956...           51.84675220747083,-133.49684680488463\n            53.040426860630475,-133.4329023938909 54.383829480227)))'

    def test_get_array(request, nctuple, polygon):
        nc, fname, var = nctuple
        t0 = time()
>       x = get_array(nc, fname, 0, polygon, var)

ce/tests/test_util.py:56: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/github/home/.local/share/virtualenvs/climate-explorer-backend-8G2w_ODg/lib/python3.8/site-packages/ce/api/util.py:90: in get_array
    a = wkt_to_masked_array(nc, resource, area, variable)
/github/home/.local/share/virtualenvs/climate-explorer-backend-8G2w_ODg/lib/python3.8/site-packages/ce/api/geo.py:135: in __call__
    result = self.func(*args)
/github/home/.local/share/virtualenvs/climate-explorer-backend-8G2w_ODg/lib/python3.8/site-packages/ce/api/geo.py:229: in wkt_to_masked_array
    return polygon_to_masked_array(nc, resource, poly, variable)
/github/home/.local/share/virtualenvs/climate-explorer-backend-8G2w_ODg/lib/python3.8/site-packages/ce/api/geo.py:261: in polygon_to_masked_array
    return polygon_to_masked_array_helper(resource)
/github/home/.local/share/virtualenvs/climate-explorer-backend-8G2w_ODg/lib/python3.8/site-packages/ce/api/geo.py:238: in polygon_to_masked_array_helper
    mask, out_transform, window = polygon_to_mask(nc, resource, poly, variable)
/github/home/.local/share/virtualenvs/climate-explorer-backend-8G2w_ODg/lib/python3.8/site-packages/ce/api/geo.py:135: in __call__
    result = self.func(*args)
/github/home/.local/share/virtualenvs/climate-explorer-backend-8G2w_ODg/lib/python3.8/site-packages/ce/api/geo.py:207: in polygon_to_mask
    with rasterio.open(dst_name, "r", driver="NetCDF") as raster:
/github/home/.local/share/virtualenvs/climate-explorer-backend-8G2w_ODg/lib/python3.8/site-packages/rasterio/env.py:435: in wrapper
    return f(*args, **kwds)
/github/home/.local/share/virtualenvs/climate-explorer-backend-8G2w_ODg/lib/python3.8/site-packages/rasterio/__init__.py:220: in open
    s = DatasetReader(path, driver=driver, sharing=sharing, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

>   ???
E   rasterio.errors.RasterioIOError: NETCDF:"/github/home/.local/share/virtualenvs/climate-explorer-backend-8G2w_ODg/lib/python3.8/site-packages/ce/tests/data/prism_pr_small.nc":pr: No such file or directory

rasterio/_base.pyx:263: RasterioIOError

Currently, this test is skipped when prism_pr_small.nc and /github are found in the filename, but the test should work properly even in the CI. This error can be recreated by removing the skip statement and pushing that change to GitHub.

@eyvorchuk eyvorchuk added the bug label Mar 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant