openghg / openghg_inversions

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

Iss55 fix outer regions #87

Closed brendan-m-murphy closed 2 months ago

brendan-m-murphy commented 4 months ago

Added option to fix outer regions when computing basis functions.

This PR also include several other changes:

  1. combine_datasets loads data before reindexing, to avoid a performance problem (https://github.com/pydata/xarray/issues/8945). Also, the default method has been set to nearest instead of ffill, since ffill tends to create NaNs in the first lat/lon coordinates.
  2. if the basis functions don't have a "region" dimension (which is the case for all of the basis functions created by our algorithms), then the projection to basis functions is done by creating a sparse matrix that maps from lat/lon to basis regions, and multiplies the footprint by this matrix. This requires the sparse package.
  3. the required version of python has been increased to 3.10. This is because changes in scipy forced changes in arviz, and these change in arviz were implemented at the same time that they increased the required version of python to 3.10. This isn't caught by pip, so we end up with an old version of arviz that is incompatible with the most recent version of scipy. On Blue Pebble, you can use load lang/python/miniconda/3.10.10.cuda-12 instead of load lang/python/anaconda to get Python 3.10 (lang/python/anaconda gives you Python 3.9, even though it says you get Python 3.10)