Allow differently dimensioned data arrays for a transfer function
Enable the following mpr.nml
:
&mainconfig
out_filename = "super_flexible_now.nc"
dim_name_alias(:,1) = "x1", "x2", "x3"
dim_name_alias(:,2) = "y1", "y2", "y3"
dim_name_alias(:,3) = "z1", "z2", "z3"
/
&Data_Arrays
names(1) = "D1"
from_file(1) = "D1.nc"
! dims "x1", "y1", "z3"
names(2) = "D2"
from_file(1) = "D2.nc"
! dims "z1", "x1", "y2"
names(3) = "D3"
from_file(1) = "D3.nc"
! dims "y3", "z2"
names(4) = "D_final"
transfer_funcs(4) = "something_with_3_args"
from_data_arrays(1:3,4) = "D1", "D2", "D3"
/
At subroutine check_data_arrays
of data array D_final, the following should happen:
- define the outer union of all dimensions at the highest resolution. Let's say that x1 has higher resolution than x2 than x3, it would be: x1, y1, z1
- check for all data_arrays, whether they have the same order of their dim_aliases (e.g. x,y,z or z,x,y) -> if not,
transpose
to the order to which to conform to would need the least transpose operations (in this case x,y,z) - check for all data_arrays, whether they have the same number of dim_aliases -> if not,
broadcast
- check for all data_arrays, whether all dimensions have the same bounds (within one dim_alias group) -> if not,
trim
to inner union - check for all data_arrays, whether all dimensions have the same vector (within one dim_alias group) -> if not,
resample
to intersect of all vector items
Effectively, this would rearrange:
- D1 to D4 with x1,y1,z1, requiring a
resample
of z3 to z1 - D2 to D5 with x1,y1,z1, requiring a
transpose
of z1,x1,y2 to x1,y2,z1 and aresample
of y2 to y1 - D3 to D6 with x1,y1,z1, requiring a
broadcast
of y3,z2 to x1,y3,z2 and aresample
of y3 to y1 and z2 to z1
resample
and trim
functionality is already contained in the get_weights
and upscale
procedures. broadcast
and transpose
would require new procedures. The concatenate
functionality should of course be preserved.