Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1d input of a LayeredModel from EvalModel #28

Open
Thomas-Ulrich opened this issue Feb 17, 2022 · 5 comments
Open

1d input of a LayeredModel from EvalModel #28

Thomas-Ulrich opened this issue Feb 17, 2022 · 5 comments

Comments

@Thomas-Ulrich
Copy link
Contributor

Hi,
I would like to define the 1d input of a LayeredModel with an EvalModel combining 2 inputs (in the real-case application, one input will be from an ASAGI component). This does not work. Do you think is it a limitation of the component or a bug?

Thanks,

Thomas.

test.yaml

!Switch
[plastCo]: !LayeredModel
      map: !Include test2.yaml
      interpolation: linear
      parameters: [plastCo]
      nodes:
        10e3:  [222339.89064034278]
        -10e3: [354563.38402222196]

test2.yaml

!EvalModel
parameters: [elevation,z]
model: !Switch
  [elevation]: !ConstantMap
    map: 
        elevation: 10.
  [z]: !AffineMap
    matrix:
      z: [0.0, 0.0, 1.0]
    translation:
      z: 0.0
components: !FunctionMap
    map:
      z_below_surface: |
        return elevation + z;

Error message:

di73yeq4@login03:/hppfs/work/pr63qo/di73yeq4/SulawesiSetupNewYann> easicube '{from: [0,0,150], to: [1,1,250], N: [1,1,10], group: 1}' test.yaml 
test.yaml: yaml-cpp: error at line 2, column 12: Layered model requires 1D input (got elevation,z).
!<!LayeredModel>
map: !<!Include> test2.yaml
interpolation: linear
parameters: [plastCo]
nodes:
  10e3: [222339.89064034278]
  -10e3: [354563.38402222196]
terminate called after throwing an instance of 'std::runtime_error'
  what():  Error while parsing easi model file.
Aborted (core dumped)
@krenzland
Copy link
Contributor

Hm, I'm not too familiar with the layered model but it sounds like it is confused about which input it should be interpolating - there's both elevation and z but you can only use this model with one coefficient.
That's at least what the documentation (and the error message) is saying:
https://easyinit.readthedocs.io/en/latest/builders.html?highlight=LayeredModel#layeredmodel

@Thomas-Ulrich
Copy link
Contributor Author

Hum 'root component', I see ...

@Thomas-Ulrich
Copy link
Contributor Author

I guess I can use a 1D ASAGI instead of the LayeredModel

@krenzland
Copy link
Contributor

Maybe you could also interpolate using a function/Lua map? For two nodes this shouldn't need too much code.

@Thomas-Ulrich
Copy link
Contributor Author

I have 150 nodes...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants