geoprior.cli.build_external_validation_fullcity#

CLI for building full-city external validation artifacts.

Functions

build_custom_objects()

build_external_validation_fullcity(*, ...[, ...])

build_external_validation_fullcity_main([argv])

build_pixel_table(inputs_npz, payload_npz, ...)

compute_external_metrics(validation_csv, ...)

ensure_dir(path)

export_fullcity_payload(stage1_manifest, ...)

get_dataset_mode(stage1_manifest)

get_feature_names(stage1_manifest)

get_forecast_horizon(stage1_manifest, fallback_h)

inverse_txy(coords_bh3, coord_scaler_path)

is_readable_file(path)

load_inference_bundle(bundle, build_inputs)

load_npz_dict(path)

mae(x, y)

main([argv])

make_full_inputs_npz(input_paths, out_npz)

median_bias(obs, pred)

nearest_match(pixels, sx, sy[, allow_swapped_xy])

read_json(path)

reduce_horizon(arr, n_seq, horizon, how)

resolve_run_dir(stage2_run_dir, ...)

resolve_stage1_artifact(...[, explicit])

resolve_stage1_inputs_paths(...)

resolve_stage2_bundle(model_path, ...[, ...])

save_npz_dict(path, data)

spearman_rho(x, y)

split_after_artifacts(path)

validate_site_matches(site_df, ...)

geoprior.cli.build_external_validation_fullcity.read_json(path)[source]#
Parameters:

path (str | Path)

Return type:

dict[str, Any]

geoprior.cli.build_external_validation_fullcity.load_npz_dict(path)[source]#
Parameters:

path (str | Path)

Return type:

dict[str, ndarray]

geoprior.cli.build_external_validation_fullcity.save_npz_dict(path, data)[source]#
Parameters:
Return type:

None

geoprior.cli.build_external_validation_fullcity.ensure_dir(path)[source]#
Parameters:

path (str | Path)

Return type:

None

geoprior.cli.build_external_validation_fullcity.is_readable_file(path)[source]#
Parameters:

path (str | None)

Return type:

bool

geoprior.cli.build_external_validation_fullcity.split_after_artifacts(path)[source]#
Parameters:

path (str)

Return type:

str | None

geoprior.cli.build_external_validation_fullcity.resolve_stage1_artifact(stage1_manifest_path, recorded_path, explicit=None)[source]#
Parameters:
  • stage1_manifest_path (str)

  • recorded_path (str | None)

  • explicit (str | None)

Return type:

str | None

geoprior.cli.build_external_validation_fullcity.resolve_stage1_inputs_paths(stage1_manifest_path, train_inputs, val_inputs, test_inputs, coord_scaler)[source]#
Parameters:
  • stage1_manifest_path (str)

  • train_inputs (str | None)

  • val_inputs (str | None)

  • test_inputs (str | None)

  • coord_scaler (str | None)

Return type:

tuple[str, str, str | None, str | None, dict[str, Any]]

geoprior.cli.build_external_validation_fullcity.make_full_inputs_npz(input_paths, out_npz)[source]#
Parameters:
Return type:

str

geoprior.cli.build_external_validation_fullcity.resolve_run_dir(stage2_run_dir, stage2_manifest_path)[source]#
Parameters:
  • stage2_run_dir (str | None)

  • stage2_manifest_path (str | None)

Return type:

str | None

geoprior.cli.build_external_validation_fullcity.resolve_stage2_bundle(model_path, stage2_manifest_path, stage2_run_dir, stage1_dir=None)[source]#
Parameters:
  • model_path (str | None)

  • stage2_manifest_path (str | None)

  • stage2_run_dir (str | None)

  • stage1_dir (str | None)

Return type:

dict[str, str | None]

geoprior.cli.build_external_validation_fullcity.build_custom_objects()[source]#
Return type:

dict[str, object]

geoprior.cli.build_external_validation_fullcity.load_inference_bundle(bundle, build_inputs)[source]#
Parameters:
geoprior.cli.build_external_validation_fullcity.get_dataset_mode(stage1_manifest)[source]#
Parameters:

stage1_manifest (dict[str, Any])

Return type:

str

geoprior.cli.build_external_validation_fullcity.get_forecast_horizon(stage1_manifest, fallback_h)[source]#
Parameters:
Return type:

int

geoprior.cli.build_external_validation_fullcity.get_feature_names(stage1_manifest)[source]#
Parameters:

stage1_manifest (dict[str, Any])

Return type:

tuple[list[str], list[str]]

geoprior.cli.build_external_validation_fullcity.export_fullcity_payload(stage1_manifest, full_inputs_npz, bundle, out_payload, batch_size, metadata=None)[source]#
Parameters:
Return type:

str

geoprior.cli.build_external_validation_fullcity.inverse_txy(coords_bh3, coord_scaler_path)[source]#
Parameters:
  • coords_bh3 (ndarray)

  • coord_scaler_path (str | None)

Return type:

ndarray

geoprior.cli.build_external_validation_fullcity.reduce_horizon(arr, n_seq, horizon, how)[source]#
Parameters:
Return type:

ndarray

geoprior.cli.build_external_validation_fullcity.build_pixel_table(inputs_npz, payload_npz, coord_scaler_path, horizon_reducer, site_reducer)[source]#
Parameters:
  • inputs_npz (str)

  • payload_npz (str)

  • coord_scaler_path (str | None)

  • horizon_reducer (str)

  • site_reducer (str)

Return type:

DataFrame

geoprior.cli.build_external_validation_fullcity.nearest_match(pixels, sx, sy, allow_swapped_xy=True)[source]#
Parameters:
Return type:

tuple[str, float, float, float, int]

geoprior.cli.build_external_validation_fullcity.spearman_rho(x, y)[source]#
Parameters:
Return type:

float

geoprior.cli.build_external_validation_fullcity.mae(x, y)[source]#
Parameters:
Return type:

float

geoprior.cli.build_external_validation_fullcity.median_bias(obs, pred)[source]#
Parameters:
Return type:

float

geoprior.cli.build_external_validation_fullcity.validate_site_matches(site_df, max_distance_m, min_unique_pixels)[source]#
Parameters:
Return type:

None

geoprior.cli.build_external_validation_fullcity.compute_external_metrics(validation_csv, full_inputs_npz, full_payload_npz, coord_scaler_path, outdir, x_col, y_col, productivity_col, thickness_col, horizon_reducer, site_reducer, max_match_distance_m, min_unique_pixels, allow_swapped_xy)[source]#
Parameters:
  • validation_csv (str)

  • full_inputs_npz (str)

  • full_payload_npz (str)

  • coord_scaler_path (str | None)

  • outdir (str)

  • x_col (str)

  • y_col (str)

  • productivity_col (str)

  • thickness_col (str)

  • horizon_reducer (str)

  • site_reducer (str)

  • max_match_distance_m (float)

  • min_unique_pixels (int)

  • allow_swapped_xy (bool)

Return type:

tuple[DataFrame, dict[str, Any]]

geoprior.cli.build_external_validation_fullcity.build_external_validation_fullcity(*, stage1_manifest, validation_csv, outdir, train_inputs=None, val_inputs=None, test_inputs=None, coord_scaler=None, model_path=None, stage2_manifest=None, stage2_run_dir=None, full_inputs_npz=None, full_payload_npz=None, batch_size=256, x_col='x', y_col='y', productivity_col='step3_specific_capacity_Lps_per_m', thickness_col='approx_compressible_thickness_m', horizon_reducer='mean', site_reducer='median', max_match_distance_m=50000.0, min_unique_pixels=3, allow_swapped_xy=True, skip_export=False)[source]#
Parameters:
  • stage1_manifest (str)

  • validation_csv (str)

  • outdir (str)

  • train_inputs (str | None)

  • val_inputs (str | None)

  • test_inputs (str | None)

  • coord_scaler (str | None)

  • model_path (str | None)

  • stage2_manifest (str | None)

  • stage2_run_dir (str | None)

  • full_inputs_npz (str | None)

  • full_payload_npz (str | None)

  • batch_size (int)

  • x_col (str)

  • y_col (str)

  • productivity_col (str)

  • thickness_col (str)

  • horizon_reducer (str)

  • site_reducer (str)

  • max_match_distance_m (float)

  • min_unique_pixels (int)

  • allow_swapped_xy (bool)

  • skip_export (bool)

Return type:

tuple[DataFrame, dict[str, Any]]

geoprior.cli.build_external_validation_fullcity.build_external_validation_fullcity_main(argv=None)[source]#
Parameters:

argv (list[str] | None)

Return type:

None

geoprior.cli.build_external_validation_fullcity.main(argv=None)[source]#
Parameters:

argv (list[str] | None)

Return type:

None