Skip to content

Support fill value conversion in vlen types#120

Merged
mjwoods merged 6 commits intomasterfrom
vlen_fill
Jun 5, 2023
Merged

Support fill value conversion in vlen types#120
mjwoods merged 6 commits intomasterfrom
vlen_fill

Conversation

@mjwoods
Copy link
Copy Markdown
Owner

@mjwoods mjwoods commented Jun 4, 2023

This PR adds support for fill values in vlen types when na.mode=5 is set for var.put.nc or var.get.nc.

The _FillValue attribute is required to have the same vlen type as the variable, and it must contain only a single vlen element. The first basetype value in the vlen element is used as the fill value. This is the approach used in the netcdf library, as described in
Unidata/netcdf-c#1011 (comment) .

@codecov
Copy link
Copy Markdown

codecov Bot commented Jun 5, 2023

Codecov Report

Patch coverage: 100.00% and project coverage change: +0.09 🎉

Comparison is base (f26d33a) 80.37% compared to head (c869f37) 80.46%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #120      +/-   ##
==========================================
+ Coverage   80.37%   80.46%   +0.09%     
==========================================
  Files          13       13              
  Lines        5777     5799      +22     
==========================================
+ Hits         4643     4666      +23     
+ Misses       1134     1133       -1     
Impacted Files Coverage Δ
src/convert.c 80.10% <100.00%> (+0.11%) ⬆️

... and 1 file with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@mjwoods
Copy link
Copy Markdown
Owner Author

mjwoods commented Jun 5, 2023

Tests of nested vlen types are only successful for NetCDF versions 4.9.0 and later, which include PR Unidata/netcdf-c#2179.

To ensure that tests succeed on all supported versions of NetCDF (from 4.1.3 upwards), we avoid testing nested vlen types on NetCDF versions less than 4.9.0 (see d7b17f5).

@mjwoods
Copy link
Copy Markdown
Owner Author

mjwoods commented Jun 5, 2023

Tests of vlen with fill value (other than nested vlen types) were successful with NetCDF versions 4.1.3, 4.8.0, 4.9.0 and 4.9.2.

The tests also worked successfully with gctorture (netcdf-4.1.3, R-4.3.0, RedHat 8), using the following command:
R CMD check --no-examples --use-gct RNetCDF_2.7-1.tar.gz

@mjwoods mjwoods merged commit 3295ee2 into master Jun 5, 2023
@mjwoods
Copy link
Copy Markdown
Owner Author

mjwoods commented Jun 6, 2023

Running the tests with both --use-gct and --use-valgrind found no memory leaks (with netcdf-4.9.2, R-4.3.0, RedHat 8).

@mjwoods mjwoods deleted the vlen_fill branch March 24, 2024 03:40
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.

1 participant