openghg / openghg_inversions

University of Bristol Atmospheric Chemistry Research Group RHIME Inversion code (with openghg dependency)
MIT License
5 stars 0 forks source link

Review "compare scales code" #37

Open brendan-m-murphy opened 5 months ago

brendan-m-murphy commented 5 months ago

In fixedbasisMCMC in older branches and get_data.py in newer branches, there is some code that checks if calibration scales are consistent:

# Check consistency of measurement scales between sites
        check_scales+=[scenario_combined.scale]
        if not all (s==check_scales[0] for s in check_scales):
            rt=[]
            for i in check_scales:
                if isinstance(i, list): rt.extend(flatten(i))
            else:
                rt.append(i)
            scales[site]=rt
        else:
            scales[site]=check_scales[0]

There are a few problems with this:

  1. flatten isn't defined, so this part of the code is (probably) never reached (i.e. i is never a list)
  2. for any site where the calibration scale is not equal to the first scale found (check_scales[0]), the scales for that site are set to all scales currently in check_scales
  3. this doesn't raise an error or log/print any information, so it's not really a "check"