Loading oper/src/cso_ncfile.F90 +33 −8 Original line number Diff line number Diff line Loading @@ -32,6 +32,9 @@ ! Renamed 'start' and 'count' arguments to 'vstart' and 'vcount' ! to avoid that compiler gets confused with 'count()' function ... ! ! 2026-07, Arjo Segers ! Keep fill-values when unpacking 2D real variable. ! ! !############################################################################### ! Loading Loading @@ -3524,6 +3527,8 @@ contains integer :: varid integer, allocatable :: dimids(:) real :: add_offset, scale_factor real :: fill_value__packed real :: fill_value ! --- begin ---------------------------------- Loading Loading @@ -3627,17 +3632,37 @@ contains ! packed? call self%Inq_VarPacking( varid, add_offset, scale_factor, status ) IF_ERROR_RETURN(status=1) if ( status == 0 ) then ! unpack: ! default fill value: fill_value = - huge(real(1.0)) ! missing value attribute? status<0 if not defined: call self%Inq_VarMissing( varid, fill_value__packed, status ) if ( status < 0 ) then ! unpack, no fill values: values = add_offset + scale_factor * values else ! unpack, take care of fill values: where ( values /= fill_value__packed ) values = add_offset + scale_factor * values elsewhere values = fill_value endwhere end if ! Missing value? if ( present( missing_value ) ) then call self%Inq_VarMissing( varid, missing_value, status ) else if ( status == 0 ) then ! missing value attribute? status<0 if not defined: call self%Inq_VarMissing( varid, fill_value, status ) IF_ERROR_RETURN(status=1) end if else TRACEBACK; status=1; return end if ! packed? ! return missing value? if ( present( missing_value ) ) missing_value = fill_value ! get units: call self%Inq_VarUnits( varid, description, units, status ) Loading Loading
oper/src/cso_ncfile.F90 +33 −8 Original line number Diff line number Diff line Loading @@ -32,6 +32,9 @@ ! Renamed 'start' and 'count' arguments to 'vstart' and 'vcount' ! to avoid that compiler gets confused with 'count()' function ... ! ! 2026-07, Arjo Segers ! Keep fill-values when unpacking 2D real variable. ! ! !############################################################################### ! Loading Loading @@ -3524,6 +3527,8 @@ contains integer :: varid integer, allocatable :: dimids(:) real :: add_offset, scale_factor real :: fill_value__packed real :: fill_value ! --- begin ---------------------------------- Loading Loading @@ -3627,17 +3632,37 @@ contains ! packed? call self%Inq_VarPacking( varid, add_offset, scale_factor, status ) IF_ERROR_RETURN(status=1) if ( status == 0 ) then ! unpack: ! default fill value: fill_value = - huge(real(1.0)) ! missing value attribute? status<0 if not defined: call self%Inq_VarMissing( varid, fill_value__packed, status ) if ( status < 0 ) then ! unpack, no fill values: values = add_offset + scale_factor * values else ! unpack, take care of fill values: where ( values /= fill_value__packed ) values = add_offset + scale_factor * values elsewhere values = fill_value endwhere end if ! Missing value? if ( present( missing_value ) ) then call self%Inq_VarMissing( varid, missing_value, status ) else if ( status == 0 ) then ! missing value attribute? status<0 if not defined: call self%Inq_VarMissing( varid, fill_value, status ) IF_ERROR_RETURN(status=1) end if else TRACEBACK; status=1; return end if ! packed? ! return missing value? if ( present( missing_value ) ) missing_value = fill_value ! get units: call self%Inq_VarUnits( varid, description, units, status ) Loading