Commit 711bdfdc authored by Robert Schweppe's avatar Robert Schweppe
Browse files

- added global switch to main section disabling the usage of nanweights

- is set to false by default to be backward-compatible
parent ef19190a
Pipeline #28207 failed with stages
in 0 seconds
......@@ -4,6 +4,7 @@ coordinate_aliases(:,1) = "XLONG", "lon", "west_east", "x", "space", "polygons"
coordinate_aliases(:,2) = "XLAT", "lat", "south_north", "y", "space", "polygons"
coordinate_aliases(:,3) = "soil_layers_stag", "horizons", "z", "sum_z"
write_weights = .true.
no_nan_along_first_dims = .false.
!read_weights = .true.
/
......
......@@ -56,6 +56,7 @@ MODULE mo_mpr_constants
logical, parameter, public :: defaultReadWeights = .false.
logical, parameter, public :: defaultWriteWeights = .false.
logical, parameter, public :: defaultCheckforNoDataValue = .false.
logical, parameter, public :: defaultNoNanAlongFirstDims = .false.
character(*), parameter, public :: defaultSubcellIdsFieldName = "subcell_ids"
character(*), parameter, public :: defaultWeightsFieldName = "weights"
character(*), parameter, public :: defaultNSubcellsFieldName = "n_subcells"
......
......@@ -18,6 +18,7 @@ module mo_mpr_data_array_upscale
use mo_mpr_upscale_func, only : wrap_upscale, wrap_weighted_upscale, get_upscale_func, upscale_func_alias
use mo_netcdf, only : NcDataset, NcVariable, NcDimension
use mo_poly, only: inpoly
use mo_mpr_global_variables, only: NO_NAN_ALONG_FIRST_DIMS
implicit none
......@@ -599,7 +600,7 @@ contains
! introduce a new array of weights for upscaling multiple coordinates:
! it is important to know for each cell that was already upscaled by how many non-nan cells it is supported
! this needs to be considered when applying the weights for upscaling
if (count(self%upscalersIndex /= nodata_i4) > 1_i4) then
if (count(self%upscalersIndex /= nodata_i4) > 1_i4 .and. .not. NO_NAN_ALONG_FIRST_DIMS) then
log_debug(*) 'execute_UpscaleHelper: Preparing upscaleHelper "', trim(self%name), &
'". Activating NanWeights because there is more than one Coordinate upscaler required: ', &
count(self%upscalersIndex /= nodata_i4)
......
......@@ -17,6 +17,7 @@ module mo_mpr_global_variables
! ------------------------------------------------------------------
logical, public :: CHECK_FOR_NODATAVALUE
logical, public :: WRITE_WEIGHTS
logical, public :: NO_NAN_ALONG_FIRST_DIMS
character(256), public :: OUT_FILENAME
end module mo_mpr_global_variables
......@@ -26,7 +26,7 @@ contains
parameterNames)
use mo_mpr_global_variables, only : &
OUT_FILENAME, CHECK_FOR_NODATAVALUE, WRITE_WEIGHTS
OUT_FILENAME, CHECK_FOR_NODATAVALUE, WRITE_WEIGHTS, NO_NAN_ALONG_FIRST_DIMS
use mo_mpr_constants, only : &
maxNoDataArrays, &
maxNoInputFieldsPerDA, &
......@@ -48,7 +48,8 @@ contains
defaultWeightsFieldName, &
defaultNSubcellsFieldName, &
maxStringLength, maxNameLength, &
defaultCheckforNoDataValue
defaultCheckforNoDataValue, &
defaultNoNanAlongFirstDims
use mo_mpr_coordinate, only : Coordinate, add_coordinate, MPR_COORDINATES
use mo_nml, only : open_nml, close_nml, position_nml
use mo_constants, only : nodata_dp, nodata_i4
......@@ -115,7 +116,8 @@ contains
character(maxNameLength), dimension(:), allocatable :: TempCoordsubDims
logical :: doesFileExist
namelist/main/ OUT_FILENAME, coordinate_aliases, WRITE_WEIGHTS, read_weights, CHECK_FOR_NODATAVALUE
namelist/main/ OUT_FILENAME, coordinate_aliases, WRITE_WEIGHTS, read_weights, CHECK_FOR_NODATAVALUE, &
NO_NAN_ALONG_FIRST_DIMS
namelist/data_arrays/ name, from_file, from_data_arrays, transfer_func, transfer_func_label, target_coord_names, &
upscale_ops, limits, to_file, from_parameter_values, from_parameter_names
namelist/coordinates/ coord_name, coord_stagger, coord_from_file, coord_from_values, &
......@@ -169,6 +171,7 @@ contains
transfer_func_label = defaultAlias
to_file = defaultDataArrayToFile
CHECK_FOR_NODATAVALUE = defaultCheckforNoDataValue
NO_NAN_ALONG_FIRST_DIMS = defaultNoNanAlongFirstDims
!===============================================================
! Read the (variable) parameters
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment