Tokyo Emissions Publication
===========================

Estimating the Fossil Fuel emissions of Tokyo with data from the TCCON station in Tsukuba and meteorological wind speed sounding.

Requirements
------------

- Python 3: http://python.org
- The python packages: numpy, scipy, matplotlib, pylab, scipy.ndimage.filters, mpl_toolkits.basemap, windrose, and gdal: Check your distribution and/or pip3
- gdal_translate: https://www.gdal.org/
- Imagemagick: http://imagemagick.org
- Pdflatex: Get it via texlive

To recreate some of the pre-processed data, you need odiac data (http://odiac.org) and TCCON data (http://tccon.ornl.gov/). Just build the paper and check the code and data availability section.

Building
--------

To create graphs and calculate results, put the TCCON data release tsukuba file (tk20110804_20160330.public.nc) into the folder tccon-data. Then call

    python3 ./plot_tccon_by_direction_cleaned.py

To build the paper, call

    make

It might fail on the first try. Just try again.

For details see the Makefile.

On Guix, use

      guix pull --commit=6bb5f88 # exact version for working netCDF4. With this version, everything in guix.scm should be reproducible
      guix environment --pure -l guix.scm
      (cd basemap-1.1.0/src && cython _geoslib.pyx && cd .. && GEOS_DIR=$HOME/.guix-profile/ python3 setup.py install --user)
      pip3 install --user pyproj pyshp
      cp ~/Downloads/proj-5.0.1/nad/epsg  ~/.local/lib/python3.7/site-packages/pyproj/proj_dir/
      echo >> ~/.local/lib/python3.7/site-packages/pyproj/__init__.py
      echo 'pyproj_datadir="/home/arne/.local/lib/python3.7/site-packages/pyproj/proj_dir/"' >> ~/.local/lib/python3.7/site-packages/pyproj/__init__.py
      PROJ_LIB=$HOME/.local/lib/python3.7/site-packages/pyproj/proj_dir/share/proj LD_LIBRARY_PATH=$HOME/.guix-profile/lib PYTHONPATH="/gnu/store/d203s90fj5f2kwcfnqrgdgxhmwmpj9ci-profile/lib/python3.7/site-packages/:${HOME}/.local:${HOME}/.guix-profile/lib/python3.7/site-packages/:${HOME}/.local/lib/python3.7/site-packages/:${PYTHONPATH}" python3 ./plot_tccon_by_direction_cleaned.py

      LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:/gnu/store/lxxz4agwzqhvcs6kxlga71w6lvpb23r6-gdal-2.2.4/lib/" PYTHONPATH="${HOME}/.guix-profile/lib/python3.7/site-packages/:/gnu/store/lxxz4agwzqhvcs6kxlga71w6lvpb23r6-gdal-2.2.4/lib/python3.7/site-packages/" make
      # yes, run make twice
      LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:/gnu/store/lxxz4agwzqhvcs6kxlga71w6lvpb23r6-gdal-2.2.4/lib/" PYTHONPATH="${HOME}/.guix-profile/lib/python3.7/site-packages/:/gnu/store/lxxz4agwzqhvcs6kxlga71w6lvpb23r6-gdal-2.2.4/lib/python3.7/site-packages/" make
