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

Add validate-overrides script to check that the parameter override JSON isn't malformed #195

Open
scottstanie opened this issue Nov 12, 2024 · 2 comments

Comments

@scottstanie
Copy link
Contributor

scottstanie commented Nov 12, 2024

  1. Add a check for malformed JSON.
    Could be a simple as pulling out the logic from Runconfig.to_workflow:
        frame_id = self.input_file_group.frame_id
        # Load any overrides for this frame
        override_params = _parse_algorithm_overrides(overrides_json, frame_id)

        # Override the dict with the new options
        param_dict = _nested_update(param_dict, override_params)
        # but then convert back to ensure all defaults remained in `param_dict`
        param_dict = AlgorithmParameters(**param_dict).model_dump()

it seems harder to really load a runconfig because of the check where we get_burst_ids_for_frame tha would error based on bad input CSLCs

  1. Add a notebook to plot which frames have overrides
@scottstanie
Copy link
Contributor Author

A start to the plotting:

import requests

overrides = requests.get(
    "https://raw.githubusercontent.com/opera-adt/burst_db/refs/heads/main/src/burst_db/data/opera-disp-s1-algorithm-parameters-overrides-2024-10-14.json"
).json()
overrides = {int(k): v for (k, v) in overrides.items()}
df_overrides = pd.DataFrame.from_records(overrides).T

# Load frame data
import opera_utils
import geopandas as gpd
import pandas as pd


gdf_frames = opera_utils.get_frame_geojson(as_geodataframe=True)
gdf_merged = gpd.GeoDataFrame(pd.merge(df_overrides, gdf_frames, left_index=True, right_index=True))
gdf_merged.explore()

image

@scottstanie
Copy link
Contributor Author

Unit test added in #213

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

1 participant