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

support editing netCDF files #41

Open
visr opened this issue Jul 27, 2022 · 0 comments
Open

support editing netCDF files #41

visr opened this issue Jul 27, 2022 · 0 comments

Comments

@visr
Copy link

visr commented Jul 27, 2022

I noticed in https://github.com/lutraconsulting/serval/pull/37/files#diff-f2560f16ca0305bd2df9c6351db8df4e106894faf5d0ad53d09fa5c6effaab4dR689 there were some updates to check_layer. One of the checks that has to pass is

os.path.isfile(layer.dataProvider().dataSourceUri()), # is it a local file?

When opening a local netCDF file in QGIS this check will always fail, since the dataSourceUri will be of the form NETCDF:"path/to/data.nc":my_var. Would it be possible to modify this check such that it passes for netCDF files? I'm not sure of a robust method that works in general, though splitting on : may be ok.

The next check check_gdal_driver_create_option, passes without problems. Though perhaps it'd be good to close the dataset created there? Is there a reason that checking the driver metadata for the creation option is not used there, like these gdal docs?

dataset = gdal.Open(layer.dataProvider().dataSourceUri(), gdal.GA_ReadOnly)
driver = dataset.GetDriver()
metadata = driver.GetMetadata()
metadata.get(gdal.DCAP_CREATE) == "YES"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant