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

netCDF: Add BAND_NAMES creation option #9657

Merged
merged 1 commit into from
Apr 15, 2024

Conversation

dbaston
Copy link
Member

@dbaston dbaston commented Apr 10, 2024

What does this PR do?

Adds an option to control the names of netCDF variables created by GDAL.

What are related issues/pull requests?

#1427
https://gis.stackexchange.com/questions/230642/setting-band-names-when-writing-multiple-layer-rasters-using-gdal-with-python
https://gis.stackexchange.com/questions/265204/gdal-creation-option-to-set-variable-name-to-netcdf

Tasklist

  • Review
  • Adjust for comments
  • All CI builds and checks have passed

@coveralls
Copy link
Collaborator

coveralls commented Apr 10, 2024

Coverage Status

coverage: 68.988% (-0.002%) from 68.99%
when pulling dcfdfa9 on dbaston:netcdf-band-names
into 732d82c on OSGeo:master.

Copy link
Collaborator

@elpaso elpaso left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

code LGTM, the codecheck CI failure seems like a false positive. As a workaround you can possibly check for poDS != nullptr.

The other gcore test failure seems unrelated.

@@ -9104,7 +9104,7 @@ netCDFDataset *netCDFDataset::CreateLL(const char *pszFilename, int nXSize,

CPLReleaseMutex(hNCMutex); // Release mutex otherwise we'll deadlock with
// GDALDataset own mutex.
netCDFDataset *poDS = new netCDFDataset();
auto poDS = std::make_unique<netCDFDataset>();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not totally sure this change is safe. See the comments around the explicit "delete poDS" about mutex deadlocks

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

// Release mutex otherwise we'll deadlock with
        // GDALDataset own mutex.

Is this referring to use of hNCMutex by netCDFDataset ? Or is it referring to the m_poPrivate->hMutex in GDALDataset ?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe this was a deadlock between hNCMutex and

CPLMutexHolderD(&hDLMutex);

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've removed this change.

@rouault rouault added this to the 3.9.0 milestone Apr 15, 2024
@rouault rouault merged commit cc83da7 into OSGeo:master Apr 15, 2024
32 checks passed
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

Successfully merging this pull request may close these issues.

4 participants