geoschem / integrated_methane_inversion

Integrated Methane Inversion workflow repository.
https://imi.readthedocs.org
MIT License
26 stars 22 forks source link

Add error trap when aggregation.py fails #244

Open msulprizio opened 2 months ago

msulprizio commented 2 months ago

Currently, when an error occurs in aggregation.py the statevector.sh script continues along without a warning or message (see example log output below). We should an error trap to let users know when the clustering of their state vector has not actually succeeded without relying on them to check that the number of state vector elements has actually changed.

=== CREATING RECTANGULAR STATE VECTOR FILE ===

Calling make_state_vector_file.py
Saving file StateVector.nc

=== DONE CREATING RECTANGULAR STATE VECTOR FILE ===

Number of state vector elements in this inversion = 4364

=== REDUCING DIMENSION OF STATE VECTOR FILE ===
Submitted batch job 39311898
Total prior emissions in region of interest = 507.8023265955999 Tg/y 

Found 230458.0 observations in the region of interest
k = [10.07223 10.07223 10.07223 ... 10.07223 10.07223 10.07223] kg-1 m2 s
a = [0. 0. 0. ... 0. 0. 0.] 

expectedDOFS: 23.78517
Traceback (most recent call last):
  File "/var/slurmd/spool/slurmd/job39311898/slurm_script", line 634, in <module>
    sensitivities = force_native_res_pixels(
  File "/var/slurmd/spool/slurmd/job39311898/slurm_script", line 232, in force_native_res_pixels
    f"No forced native pixels specified or in {config['PointSourceDatasets']} dataset."
KeyError: 'PointSourceDatasets'

Number of state vector elements in this inversion = 4364