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

Fix/thicknesses_ #112

Closed
wants to merge 73 commits into from
Closed

Fix/thicknesses_ #112

wants to merge 73 commits into from

Conversation

AngRodrigues
Copy link
Member

@AngRodrigues AngRodrigues commented Jul 9, 2024

Summary of major changes:

  • Thickness outputs from all thickness calculators are now merged
  • LPF version pinned to 1.4
  • Added folder with datasets in map2loop/_datasets/geodata_files/hamersley. The idea behind this is to have a data loading function, e.g., at the moment load_hamersley_geology() returns a gdf with the geology; structure and dtm are available, and others will be added later on. This is quite useful for tests, but should also be useful for when we implement [Feature Request] - create map2loop project from geopandas array not file paths #74. The only thing about this is the location, which implies a long import: from map2loop._datasets.geodata_files.hamersley import load_hamersley_geology. Happy to change the file location - does anyone has a suggestion?
  • Minimum fault length is now a parameter of the config file, and it actually removes the faults with length under defined value.
  • Removed the project.set_minimum_fault_length method to avoid users setting the parameter twice.
  • added all_basal_contacts object which are abnormal+basal contacts , and basal_contacts holds only the basal. Reconstruction of sampled_basal_contacts is based on basal_contacts
  • changed the thickness_calculator_alpha to be coherent with the logic of the other thickness calculators
  • added tests for some of the functions in mapdata.py
  • added tests for thickness_compute in project.py
  • rewrote tests for all thickness calculators independently (now without having to run the project)

summary of other minor modifications:

  • tmpfile is now used to create the localGdalfile
  • changed to f"" strings where possible
  • change from os.path.join to pathlib.Path where possible
  • added geopandas to csv converter in mapdata (it was on a #TODO)
  • added check and error message to make sure that all units in user_defined_stratigraphic_column are in the geology file (otherwise project creation fails; at least now user has a warning).
  • renamed distance to stratigraphic_distance in basal_contacts creation
  • removed set_ and get_thickness_calculator
  • rectified minor typos in the thickness calculators
  • added a Linalgerror catch/pass for the InterpolatedStructure

Fixes #86
Fixes #110
Fixes #111
Fixes #12

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • Test improvement

How Has This Been Tested?

The branch is fix/thicknesses_AR_2.

Checklist:

  • This branch is up-to-date with master
  • All gh-action checks are passing
  • I have performed a self-review of my own code
  • My code follows the style guidelines of this project
  • I have commented my code, particularly in hard-to-understand areas
  • I have added tests that prove my fix is effective or that my feature works
  • My tests run with pytest from the map2loop folder
  • New and existing tests pass locally with my changes

@AngRodrigues AngRodrigues marked this pull request as ready for review July 9, 2024 00:35
@AngRodrigues AngRodrigues changed the title Fix/thicknesses ar 2 Fix/thicknesses_ Jul 9, 2024
map2loop/mapdata.py Outdated Show resolved Hide resolved
map2loop/project.py Outdated Show resolved Hide resolved
map2loop/project.py Outdated Show resolved Hide resolved
map2loop/project.py Outdated Show resolved Hide resolved
map2loop/project.py Outdated Show resolved Hide resolved
Copy link
Member

@lachlangrose lachlangrose left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I haven't reviewed or tested the code but I have made some suggestions within the code.

My main comment for this PR is that the changes to the thickness calculators have not been implemented in the modular framework of map2loop. Instead of setting the list of thickness calculators within the method calling the thickness calculators, the list of thickness calculators should be managed by the project class. The default list can be hard coded using the current three, but the user should be able to call set_thickness_calculators and provide a custom list of thickness calculators.

This would mean, if the thicknesss calculators have any parameters e.g. the threshold angle for the structure point, or the interpolator type for the interpolated structure these could be set by the user and the thickness calculator objects can be set.

@AngRodrigues AngRodrigues marked this pull request as ready for review October 31, 2024 03:30
@AngRodrigues
Copy link
Member Author

I think the documentation doesn't need to be built for all branches. We can make it only run on master release. I am also not sure whether documentation build/deploy should just be a manually run item that is triggered on release but can also just be run manually. This could be the same issue as the package building, it really only needs to run on master not on other branches.

@lachlangrose, I agree. Added these changes to the workflow in this PR; left the sdist jobs so that the tests run on the branch.

@AngRodrigues AngRodrigues marked this pull request as draft November 1, 2024 01:49
@AngRodrigues
Copy link
Member Author

AngRodrigues commented Nov 1, 2024

Edits on 1/11/2024:

  • updated methods for minimum_fault_length
  • minimum fault length calculated from project's bbox, if not defined by user in the config_dictionary.
  • thickness outputs can be still merged, but modularity has been added as suggested. User can set up to 5 thickness calculators (default is InterpolatedStructure).
  • Methods set_thickness_calculator and get_thickness_calculator are available again, and used likeso:
from map2loop.thickness_calculator import ThicknessCalculatorAlpha, InterpolatedStructure, StructuralPoint

[..set up the project..]

project.set_thickness_calculator([StructuralPoint(), InterpolatedStructure()])
project.get_thickness_calculator()

Output:
['StructuralPoint', 'InterpolatedStructure']
  • LPF stores results and name of the thickness calculator as a new field in the LPF. This works with the LPF branch here - https://github.com/Loop3D/LoopProjectFile/tree/fix_thicknesses
  • Added ignore codes both for lithology and faults (works by feature name, and similar to the existing method). Added methods for set and get with _ignore_lithology_codes() and _ignore_fault_codes(). Example of working example code to achieve this can be seen in map2loop/tests/project/test_ignore_codes_setters_getters.py.
  • Added and updated appropriate tests for all new added features.
  • updated CI to run docs and builds workflows only on master branch.
  • added small fixes for:

@lachlangrose @rabii-chaarani the PR is ready for re-review now.
Thank you!

@AngRodrigues AngRodrigues marked this pull request as ready for review November 1, 2024 04:14
@AngRodrigues AngRodrigues changed the base branch from master to v3.2 November 20, 2024 00:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants