Skip to content

Commit

Permalink
Removed @tparam from netcdf variable docstrings and added a default c…
Browse files Browse the repository at this point in the history
…lass to setFill/putVar select type statements.
  • Loading branch information
amstokely committed Feb 8, 2025
1 parent 27bba5c commit b98c638
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
2 changes: 0 additions & 2 deletions obs2ioda-v2/src/cxx/netcdf_variable.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ namespace Obs2Ioda {
/**
* @brief Writes data to a variable in a NetCDF file.
*
* @tparam T The data type of the variable.
* @param netcdfID The identifier of the NetCDF file where the data will be written.
* @param groupName The name of the group containing the variable. If nullptr, the variable is assumed to be in the root group.
* @param varName The name of the variable to which data will be written.
Expand Down Expand Up @@ -71,7 +70,6 @@ namespace Obs2Ioda {
/**
* @brief Sets the fill mode and fill value for a variable in a NetCDF file.
*
* @tparam T The data type of the fill value.
* @param netcdfID The identifier of the NetCDF file containing the variable.
* @param groupName The name of the group containing the variable. If nullptr, the variable is assumed to be in the root group.
* @param varName The name of the variable for which the fill mode is set.
Expand Down
16 changes: 12 additions & 4 deletions obs2ioda-v2/src/netcdf_cxx_mod.f90
Original file line number Diff line number Diff line change
Expand Up @@ -201,8 +201,10 @@ end function netcdfAddVar
!
! Returns:
! - integer(c_int): A status code indicating the outcome of the operation:
! - 0: Success.
! - Non-zero: Failure.
! - 0: Success.
! - -1: NetCDF operation returned an error, but the error code was 0.
! - -2: Unsupported type passed for values.
! - Other nonzero values: Specific NetCDF error codes.
function netcdfPutVar(netcdfID, varName, values, groupName)
integer(c_int), value, intent(in) :: netcdfID
character(len = *), intent(in) :: varName
Expand Down Expand Up @@ -243,6 +245,8 @@ function netcdfPutVar(netcdfID, varName, values, groupName)
c_values = f_c_string_1D_values%to_c(values)
netcdfPutVar = c_netcdfPutVarString(netcdfID, c_groupName, &
c_varName, c_values)
class default
netcdfPutVar = -2
end select
end function netcdfPutVar

Expand All @@ -267,8 +271,10 @@ end function netcdfPutVar
!
! Returns:
! - integer(c_int): A status code indicating the outcome of the operation:
! - 0: Success.
! - Non-zero: Failure.
! - 0: Success.
! - -1: NetCDF operation returned an error, but the error code was 0.
! - -2: Unsupported type passed for fillValue.
! - Other nonzero values: Specific NetCDF error codes.
function netcdfSetFill(netcdfID, varName, fillMode, fillValue, groupName)
integer(c_int), value, intent(in) :: netcdfID
character(len = *), intent(in) :: varName
Expand Down Expand Up @@ -306,6 +312,8 @@ function netcdfSetFill(netcdfID, varName, fillMode, fillValue, groupName)
netcdfSetFill = c_netcdfSetFillString(netcdfID, c_groupName, &
c_varName, fillMode, &
f_c_string_fillValue%to_c(fillValue))
class default
netcdfSetFill = -2
end select
end function netcdfSetFill

Expand Down

0 comments on commit b98c638

Please sign in to comment.