SeisSol / easi

A library for the Easy Initialization of model parameters.
https://easyinit.readthedocs.io/en/latest/
BSD 3-Clause "New" or "Revised" License
1 stars 6 forks source link

ASAGI 1d gives unexpected resuts #38

Closed Thomas-Ulrich closed 2 years ago

Thomas-Ulrich commented 2 years ago

Here are 2 NetCDF files:

di73yeq4@login04:/hppfs/work/pr63qo/di73yeq4/bug_easi_asagi> ncdump file_12.nc 
netcdf file_12 {
dimensions:
        u = 4 ;
variables:
        float u(u) ;
        float z_bot(u) ;
data:

 u = -1e+09, 0, 10, 12 ;

 z_bot = 0, 0, 1, 1 ;
}
di73yeq4@login04:/hppfs/work/pr63qo/di73yeq4/bug_easi_asagi> ncdump file_1e9.nc 
netcdf file_1e9 {
dimensions:
        u = 4 ;
variables:
        float u(u) ;
        float z_bot(u) ;
data:

 u = -1e+09, 0, 10, 1e+09 ;

 z_bot = 0, 0, 1, 1 ;
}

and here are the associated YAML files:

di73yeq4@login04:/hppfs/work/pr63qo/di73yeq4/bug_easi_asagi> cat test.yaml 
!AffineMap
        matrix:
          u: [0.0, 1.0, 0.0]
        translation:
          u: 0.0
        components: !ASAGI
          file: file_12.nc
          parameters: [z_bot]
          var: z_bot
          interpolation: linear
di73yeq4@login04:/hppfs/work/pr63qo/di73yeq4/bug_easi_asagi> cat test1e9.yaml 
!AffineMap
        matrix:
          u: [0.0, 1.0, 0.0]
        translation:
          u: 0.0
        components: !ASAGI
          file: file_1e9.nc
          parameters: [z_bot]
          var: z_bot
          interpolation: linear

I want to evaluate the file at y=10. 10 being a node, I should get the node value for both files, that is 1. But instead, I get from:

../myLibs/spack-packages/linux-sles15-skylake_avx512/easi/1.2.0-gcc-11.2.0-6wcp5d7/bin/easicube "{from: [0,10,0], to: [1,11,1], N: [2, 2, 2]}" test.yaml aa; ncdump aa.nc
../myLibs/spack-packages/linux-sles15-skylake_avx512/easi/1.2.0-gcc-11.2.0-6wcp5d7/bin/easicube "{from: [0,10,0], to: [1,11,1], N: [2, 2, 2]}" test1e9.yaml aa; ncdump aa.nc

The following output:

1,8,0.010111,0.000157086
netcdf aa {
dimensions:
        x = 2 ;
        y = 2 ;
        z = 2 ;
variables:
        double z_bot(z, y, x) ;
data:

 z_bot =
  1, 1,
  1, 1,
  1, 1,
  1, 1 ;
}
1,8,0.00878582,0.000110264
netcdf aa {
dimensions:
        x = 2 ;
        y = 2 ;
        z = 2 ;
variables:
        double z_bot(z, y, x) ;
data:

 z_bot =
  0.500000015, 0.500000015,
  0.5000000165, 0.5000000165,
  0.500000015, 0.500000015,
  0.5000000165, 0.5000000165 ;
}

test1e9.yaml does not return the expected results (1) but 0.5. Why?

files: /hppfs/work/pr63qo/di73yeq4/bug_easi_asagi

Thomas-Ulrich commented 2 years ago

In the end, what seems not supported (but does not raise an error) is the use of non-regularly sampled grids. I suppose ASAGI does support it. Maybe the linear interpolation of easi is not thought to work with non-regularly sampled grids? An easy fix would be to raise an error. A better fix would be to fix the code for non-regularly sampled grids.

krenzland commented 2 years ago

I'm pretty sure that ASAGI does not support non-regularly sampled grids.

Thomas-Ulrich commented 2 years ago

ok I checked that, you are right.