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

gz is a required parameter for gravity inversion and tmi is required for mag inversion, which prevents inversion of component- or gradient-only data #563

Open
nwilliams-kobold opened this issue May 15, 2023 · 9 comments

Comments

@nwilliams-kobold
Copy link
Contributor

We’re trying to run a Falcon guv+gxy inversion in geoapps 0.9.2 , and it seems that it is not possible without defining gz?
OptionalValidationError: Cannot set a None value to non-optional parameter: gz_channel.

We are creating the geoh5 and json files directly using geoapps.inversion.potential_fields.gravity.params rather than using the GUI:

json_out = params.GravityParams(
…
    gz_channel_bool = False,
    gz_channel = None,
    guv_channel_bool = True,
    guv_channel = data_uid,
    guv_uncertainty = error_uid,
…
)
json_out.write_input_file(…)

The solution seems to be allowing gz to be optional, but requiring at least 1 of the possible components.

@github-actions
Copy link

JIRA issue [GEOPY-952] was created.

@nwilliams-kobold nwilliams-kobold changed the title gz is a require parameter for gravity inversion, which prevents inversion of components only gz is a required parameter for gravity inversion, which prevents inversion of gravity components only May 15, 2023
@nwilliams-kobold
Copy link
Contributor Author

nwilliams-kobold commented May 15, 2023

It looks like this might be related to this change: d85d6a6#diff-b2146808eb22eb72329ba3b92cab9e47d7875ab323aa506740ff9529a5000562L238 (Line 238 of gravity.constants)

If that is the problem then the same change was also made to the mag inversion code to require TMI (and therefore prevent use of other components without TMI) in line 254 of magnetic_vector.constants from the same PR.

@RichardScottOZ
Copy link
Contributor

Does it matter which one?

@nwilliams-kobold
Copy link
Contributor Author

nwilliams-kobold commented May 15, 2023

We have confirmed that this also occurs in the inversion application too, when selecting only non-gz components:
image

@nwilliams-kobold
Copy link
Contributor Author

Does it matter which one?

No. If gz is not supplied it fails.

@nwilliams-kobold
Copy link
Contributor Author

nwilliams-kobold commented May 16, 2023

Can also confirm the same behaviour for mag inversions: If tmi is not supplied, the json file cannot be written.
OptionalValidationError: Cannot set a None value to non-optional parameter: tmi_channel.
(Here I supplied bz instead).

@nwilliams-kobold nwilliams-kobold changed the title gz is a required parameter for gravity inversion, which prevents inversion of gravity components only gz is a required parameter for gravity inversion and tmi is required for mag inversion, which prevents inversion of component- or gradient-only data May 16, 2023
@nwilliams-kobold
Copy link
Contributor Author

nwilliams-kobold commented May 16, 2023

Furthermore I have identified that the issue comes from the default validations that are set. Calling

from geoapps.inversion.potential_fields.gravity import params as grav_params
...
params = grav_params.GravityParams(
    geoh5 = ws.h5file,
    data_object = points.uid, 
    topography_object = surface.uid, 
    guv_channel = data_uid,
    guv_uncertainty = error_uid,
    ...
)

and then calling params.input_file.ui_json['gz_channel'] gives:

{'association': ['Cell', 'Vertex'],
 'dataType': 'Float',
 'group': 'Data',
 'main': True,
 'label': 'Gz (mGal)',
 'parent': 'data_object',
 'optional': True,              << CORRECT
 'enabled': True,               << INCORRECT, but even when I reset this key to False, the error still occurs
 'value': None}

but calling params.validations['gz_channel'] gives:

{'types': [str, uuid.UUID, geoh5py.shared.entity.Entity],
 'association': 'data_object',
 'uuid': None,
 'optional': False,              << INCORRECT
 'one_of': 'data channel'}

Hence the error: OptionalValidationError: Cannot set a None value to non-optional parameter: gz_channel.

@nwilliams-kobold
Copy link
Contributor Author

Any updates on this ticket? It prevents us from upgrading from 0.8.

@domfournier
Copy link
Contributor

Sorry for the late reply. Should have been fixed on release/0.11.0. We will test on next sprint.

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

No branches or pull requests

3 participants