Skip to content

Commit 24027d8

Browse files
committed
Merge branch 'release/0.23.0.1' into develop
# Conflicts: # recipe.yaml
2 parents 8c73f06 + 37dea59 commit 24027d8

3 files changed

Lines changed: 56 additions & 14 deletions

File tree

.github/workflows/python_deploy_prod.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ concurrency:
2626
jobs:
2727
call-workflow-conda-release:
2828
name: Publish production Conda package on JFrog Artifactory
29-
uses: MiraGeoscience/CI-tools/.github/workflows/reusable-python-release_conda_assets.yml@main
3029
if: ${{ github.event_name == 'release' || github.event.inputs.publish-conda == 'true' }}
30+
uses: MiraGeoscience/CI-tools/.github/workflows/reusable-python-release_conda_assets.yml@main
3131
with:
3232
virtual-repo-names: '["public-conda-prod"]'
3333
release-tag: ${{ github.event.release.tag_name || github.event.inputs.release-tag }}

simpeg/directives/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,7 @@
126126
BaseSaveGeoH5,
127127
SaveDataGeoH5,
128128
SaveLogFilesGeoH5,
129+
SaveLPModelGroup,
129130
SaveModelGeoH5,
130131
SavePropertyGroup,
131132
SaveSensitivityGeoH5,

simpeg/directives/_save_geoh5.py

Lines changed: 54 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,9 @@
88
from .directives import InversionDirective
99
from simpeg.maps import IdentityMap
1010

11+
from geoh5py.data import NumericData
1112
from geoh5py.groups.property_group import GroupTypeEnum
12-
from geoh5py.groups import PropertyGroup, UIJsonGroup
13+
from geoh5py.groups import UIJsonGroup
1314
from geoh5py.objects import ObjectBase
1415
from geoh5py.ui_json.utils import fetch_active_workspace
1516

@@ -419,7 +420,7 @@ def save_log(self):
419420

420421
class SavePropertyGroup(BaseSaveGeoH5):
421422
"""
422-
Save the model as a property group in the geoh5 file
423+
Assign the data to a property group in the geoh5 file
423424
"""
424425

425426
def __init__(
@@ -446,21 +447,61 @@ def write(self, iteration: int, **_):
446447
channel_name, base_name = self.get_names(
447448
component, channel, iteration
448449
)
449-
child = [
450+
children = [
450451
child
451452
for child in h5_object.children
452-
if channel_name in child.name
453-
][0]
453+
if (
454+
channel_name in child.name
455+
and isinstance(child, NumericData)
456+
)
457+
]
454458

455-
if child is not None:
456-
properties.append(child)
459+
if children[0] is not None:
460+
properties += children
457461

458462
if len(properties) == 0:
459463
return
460464

461-
PropertyGroup(
462-
parent=h5_object,
463-
name=base_name,
464-
properties=properties,
465-
property_group_type=self.group_type,
466-
)
465+
prop_group = h5_object.get_property_group(base_name)[0]
466+
467+
if prop_group is None:
468+
prop_group = h5_object.create_property_group(
469+
name=base_name,
470+
properties=properties,
471+
property_group_type=self.group_type,
472+
)
473+
else:
474+
prop_group.add_properties(properties)
475+
476+
477+
class SaveLPModelGroup(SavePropertyGroup):
478+
"""
479+
Save the model as a property group in the geoh5 file
480+
"""
481+
482+
def __init__(
483+
self,
484+
h5_object,
485+
irls_directive,
486+
group_type: GroupTypeEnum = GroupTypeEnum.MULTI,
487+
**kwargs,
488+
):
489+
self.group_type = group_type
490+
self.irls_directive = irls_directive
491+
492+
super().__init__(h5_object, **kwargs)
493+
494+
def get_names(
495+
self, component: str, channel: str, iteration: int
496+
) -> tuple[str, str]:
497+
"""
498+
Format the data and property_group name.
499+
"""
500+
channel_name, base_name = super().get_names(component, channel, iteration)
501+
502+
if self.irls_directive.metrics.irls_iteration_count == 0:
503+
base_name = "L2 models"
504+
else:
505+
base_name = "LP models"
506+
507+
return channel_name, base_name

0 commit comments

Comments
 (0)