A curated list of open technology projects to sustain a stable climate, energy supply, biodiversity and natural resources.

OpenMethane

Method to calculate a gridded, prior emissions estimate for methane across Australia.
https://github.com/openmethane/openmethane-prior

Category: Emissions
Sub Category: Emission Observation and Modeling

Keywords from Contributors

climate-change climate-data

Last synced: about 20 hours ago
JSON representation

Repository metadata

Method to calculate a gridded, prior emissions estimate for methane across Australia

README.md

OpenMethane prior emissions estimate

Method to calculate a gridded, prior emissions estimate for methane across Australia.

This repository is matched with downloadable input data so that it will run out of the box.

Initialise

Copy the .env.example file to .env and customise the paths as you need.

In order to download the GFAS emissions data, credentials for the Copernicus
Atmospheric Data Store (ADS) API are required. Instructions for registering for
the ADS API and setting up the credentials are provided at
ADS Docs.

Step-by-step:

Note: the ADS API is different from the CDS (Climate Data Store) API
even though they are both parts of the Copernicus program
and share the same credentials file.

Requirements

Before installation, you will need to make sure that poetry version 1 is installed.

Step-by-step:

  • Install pipx
python -m pip install --user pipx
  • Install poetry and downgrading your poetry version to version v1.
pipx install poetry~=1.0 --force

Installation

The Open Methane prior can be installed from source into a virtual environment with:

make virtual-environment

The Makefile contains the set of commands to create the virtual environment.
You can read the instructions out and run the commands by hand if you wish.

Input Data

To download all the required input files, run:

make download

This will download input files that match the data in .env,
so you have a working set to get started with.

The downloaded files will be stored in data/inputs by default.

Domain Info

The domain of interest for the prior is defined using an input domain netCDF file.
The format of the input domain is based on the CMAQ domain file format. Note that CMAQ uses a
staggered grid
where some quantities are defined at the center of a grid cell, whereas other quantities are defined
at the edges of a grid cell. This circumstance is represented in ROW_D = ROW + 1.

This input file should contain the following variables:

  • LAT
  • LON
  • LANDMASK
  • LATD
  • LOND

The contents of the default domain is shown below:

>>> ncdump -h prior_domain_aust10km_v1.0.0.d01
netcdf prior_domain_aust10km_v1.0.0.d01 {
dimensions:
        TSTEP = 1;
        ROW = 430;
        COL = 454;
        LAY = 1;
        ROW_D = 431;
        COL_D = 455;
variables:
        float LAT(TSTEP, ROW, COL);
                LAT:_FillValue = NaNf;
                LAT:long_name = "LAT";
                LAT:units = "DEGREES";
                LAT:var_desc = "latitude (south negative)";
        float LON(TSTEP, ROW, COL);
                LON:_FillValue = NaNf;
                LON:long_name = "LON";
                LON:units = "DEGREES";
                LON:var_desc = "longitude (west negative)";
        float LANDMASK(TSTEP, ROW, COL);
                LANDMASK:_FillValue = NaNf;
                LANDMASK:long_name = "LWMASK";
                LANDMASK:units = "CATEGORY";
                LANDMASK:var_desc = "land-water mask (1=land, 0=water)";
        float LATD(TSTEP, LAY, ROW_D, COL_D);
                LATD:_FillValue = NaNf;
                LATD:long_name = "LATD";
                LATD:units = "DEGREES";
                LATD:var_desc = "latitude (south negative) -- dot point";
        float LOND(TSTEP, LAY, ROW_D, COL_D);
                LOND:_FillValue = NaNf;
                LOND:long_name = "LOND";
                LOND:units = "DEGREES";
                LOND:var_desc = "longitude (west negative) -- dot point";

// global attributes:
                :DX = 10000.f;
                :DY = 10000.f;
                :TRUELAT1 = -15.f;
                :TRUELAT2 = -40.f;
                :MOAD_CEN_LAT = -27.644f;
                :STAND_LON = 133.302f;
                :XCELL = 10000.;
                :YCELL = 10000.;
                :XCENT = 133.302001953125;
                :YCENT = -27.5;
                :XORIG = -2270000.;
                :YORIG = -2165629.25;
}

As part of the OpenMethane project,
we have provided a domain file for a 10km grid over Australia.

This file will be downloaded with the other layer inputs (see Input Data) using the default configuration
values.

Clean outputs

These two commands are set up so that not all generated files have to be deleted manually
Delete all files in the intermediates and outputs directory with

make clean

Or delete all files in intermediates, outputs, and inputs directory with

make clean-all

Run

All layers

To calculate emissions for all layers, run omPrior.py with a start and end date:

poetry run python scripts/omPrior.py --start-date 2022-07-01 --end-date 2022-07-01

or use the make target

make run

This takes a while to process (~10 minutes) with the vast majority of that time spent on the layers
in omAgLulucfWasteEmis.py.

To skip re-projecting raster layers (you only need to do this once for every time you change the raster input files),
add the --skip-reproject option.

Single layers

You can run and re-run individual layers one-by-one. Just run each file on it's own (GFAS and Wetlands require a start
and end date as below):

poetry run python src/openmethane_prior/layers/omWetlandEmis.py --start-date 2022-07-01 --end-date 2022-07-01

Outputs

Outputs can be found in the data/outputs folder. The emissions layers will be written as variables to a copy of the
input domain file, with an OCH4_ prefix for the methane layer variable names. The sum of all layers will be stored in
the OCH4_TOTAL layer.

The name of the layered output file will be om-prior-output.nc.

The data/processed folder will contain any re-projected raster data, and any files downloaded or generated in the
process.

Outputs can be plotted using the ncl file plot_emis.ncl.

ncl plot_emis.ncl

Layers

Many sectors are taken from data sets used in by Saunois et al (2020) (doi:10.5194/essd-12-1561-2020)

  • Livestock: Enteric fermentation emissions generated by CSIRO Ag. and Food using livestock census data and UNFCCC
    emissions factors
  • Electricity: Uses OpenNEM facility data to spatialise the Aust. Gov UNFCCC electricity emissions
  • Agriculture: Agricultural emissions apart from livestock taken from the Agricultural emissions of the NGGI and
    spatialised according to the agriculture land-use mask
  • Fugitives: Facility-level data from ACF (more info?)
  • Industrial: Spatialises the industrial sector of the NGGI according to nighttime lights
  • Stationary: Spatialises the stationary energy sector of the NGGI according to nighttime lights
  • Transport: Spatialises the transport sector of the NGGI according to nighttime lights
  • Waste: Spatialises the NGGI waste emission according to the landuse map
  • LULUCF: Spatialises the LULUCF emission from the NGGI according to the landuse map
  • FIRE: daily emissions from the Global Fire Assimilation System (Kaiser et al., 2012, doi:10.5194/bg-9-527-2012)
  • wetland: Monthly wetland emissions from the diagnostic ensemble used in Saunois et al. 2020 and described in Zhang et
    al. (2023 under review)
  • Termite: Termite emissions used in Saunois et al. 2020 supplied by Simona Castaldi and Sergio Noce

Data directories

  • data/inputs
    This folder should contain all the required input files, which should be referenced in the .env file at the root.
    A set of input files has been included in the repository so that it functions out of the box (see Input Data), but you can add your own
    data here.
  • data/inputs/domains The domain of interest is stored in this folder (see domain info).
  • data/intermediates This folder contains any intermediate files generated through the process. Everything within this folder should be ignored.
  • data/outputs Outputs files will be saved here.

Run in a Docker container

To carry out the steps described above in a Docker container, first build the Docker image with

make build

Then run the commands to download the input data in the docker container

docker run --rm -v </your/path/to/openmethane-prior>:/opt/project openmethane-prior python scripts/omDownloadInputs.py

Replace the python files according to the commands in the Makefile for the other steps.

For developers

The ruff-fixes target runs a series of ruff commands to format the code, check and fix linting
issues, and then format the code again to ensure that all formatting and fixes are applied.

make ruff-fixes

The test target will run all the tests

make test

Owner metadata


GitHub Events

Total
Last Year

Committers metadata

Last synced: 6 days ago

Total Commits: 335
Total Committers: 9
Avg Commits per committer: 37.222
Development Distribution Score (DDS): 0.699

Commits in past year: 242
Committers in past year: 8
Avg Commits per committer in past year: 30.25
Development Distribution Score (DDS) in past year: 0.62

Name Email Commits
Jared Lewis j****d@j****z 101
Daniel Busch d****h@c****m 92
Peter Rayner p****r@u****u 54
Lindsay Gaines l****s@s****u 43
Gerard Mason g****n@s****u 32
crdanielbusch 1****h 7
aethr c****r@o****d 4
Mika Pflüger m****r@c****m 1
Ida Jandl i****4@g****u 1

Committer domains:


Issue and Pull Request metadata

Last synced: 2 days ago

Total issues: 29
Total pull requests: 47
Average time to close issues: 22 days
Average time to close pull requests: 7 days
Total issue authors: 6
Total pull request authors: 7
Average comments per issue: 2.79
Average comments per pull request: 1.85
Merged pull request: 38
Bot issues: 0
Bot pull requests: 2

Past year issues: 27
Past year pull requests: 39
Past year average time to close issues: 22 days
Past year average time to close pull requests: 6 days
Past year issue authors: 6
Past year pull request authors: 7
Past year average comments per issue: 2.81
Past year average comments per pull request: 1.92
Past year merged pull request: 31
Past year bot issues: 0
Past year bot pull requests: 2

More stats: https://issues.ecosyste.ms/repositories/lookup?url=https://github.com/openmethane/openmethane-prior

Top Issue Authors

  • aethr (13)
  • crdanielbusch (5)
  • lewisjared (4)
  • Ida-droid (3)
  • NasimehShahrokhi (2)
  • prayner (2)

Top Pull Request Authors

  • lewisjared (21)
  • aethr (12)
  • crdanielbusch (8)
  • dependabot[bot] (2)
  • prayner (2)
  • Ida-droid (1)
  • mikapfl (1)

Top Issue Labels

  • triage (7)
  • bug (5)
  • documentation (4)
  • enhancement (4)
  • help wanted (1)

Top Pull Request Labels

  • dependencies (2)
  • enhancement (1)

Dependencies

js/requirements.txt pypi
  • Shapely *
  • netCDF4 *
  • numpy *
  • pandas *
  • pyception *
  • python_dateutil *
  • scipy *
requirements.txt pypi
  • bisect *
  • cdsapi *
  • colorama *
  • geopandas *
  • netCDF4 *
  • numpy *
  • pandas *
  • pyproj *
  • python-dotenv *
  • rioxarray *
  • samgeo *
  • shapely *
  • xarray *

Score: 5.087596335232384