Skip to content

Script for automating gas flux calculations done with LI-7810.

Notifications You must be signed in to change notification settings

kootepe/fluxObject

Repository files navigation

Flux calculator

Script for calculating gas fluxes from automatic chambers and manual measurements measured with LI-COR LI-7810.

Intro

Script is mainly meant to be automated with a docker container, but it can just as well be ran manually whenever you want.

Currently there's only an excel output and the possibility to push results into influxdb.

ini files

The ini files will define where to read files, what files to read, what data to read in the files and the influxdb instances to push the data to.

examples for flux calculation
Breakdown of the .ini for automatic chamber measurements.
Breakdown of the .ini for manual chamber measurements.

Timestamps in the ini need to be in strftime format. eg. 2023-01-01 00:00:00 would be %Y-%m-%d %H:%M:%S. And in the .ini needs to be written with doubled '%' marks, as %%Y-%%m-%%d %%H:%%M:%%S.

timestamp:
2023-01-01 00:00:00
in ini:
%%Y-%%m-%%d %%H:%%M:%%S

Setting up automated calculations with docker

The docker image is built with the docker-compose.yml file. To avoid having any paths in the codebase here, they are defined with a .env file.

The docker image is built from the dockerfile, it builds an image which has cron for timing script runs, vim for text the editor and copies this github repo inside the container. In the docker-compose volumes part are defined the folders inside your machine that will be mounted inside the docker container, so that the data is visible for the container.

docker-compose.yml is used to define how the build the docker image.

The format of the .env file is like this, it's used to define the filepaths that will be mounted inside the container.

INI_DIR=/path/to/inis
AUTOCHAMBER_DIR=/path/to/ac/data
MANUAL_DIR=/path/to/manual/data
MANUAL_TIMES_DIR=/path/to/manual/times
AIR_DATA_DIR=/path/to/air/data
SNOW_MEASUREMENT=/path/to/snow/measurement
EXCEL_DIR=/path/to/excels

INI_DIR_PATH=/data/inis
AUTOCHAMBER_DIR_PATH=/data/autochamber_measurement
MANUAL_DIR_PATH=/data/manual_measurement
MANUAL_TIMES_DIR_PATH=/data/manual_measurement_times
AIR_DATA_DIR_PATH=/data/air_data
SNOW_MEASUREMENT_PATH=/data/snow_measurement
EXCEL_DIR_PATH=/data/excel_summaries

These paths are mapped into the docker container with the docker-compose.yml which looks like this:

version: "3.4"
services:
  python:
    build: 
      context: ./
      dockerfile: ./dockerfile
    env_file: ./.env
    volumes:
      - ${AIR_DATA_DIR}:${AIR_DATA_DIR_PATH}
      - ${INI_DIR}:${INI_DIR_PATH}
      - ${AUTOCHAMBER_DIR}:${AUTOCHAMBER_DIR_PATH}:ro
      - ${MANUAL_DIR}:${MANUAL_DIR_PATH}:ro
      - ${MANUAL_TIMES_DIR}:${MANUAL_TIMES_DIR_PATH}
      - ${SNOW_MEASUREMENT}:${SNOW_MEASUREMENT_PATH}
      - ${EXCEL_DIR}:${EXCEL_DIR_PATH}
    entrypoint:
      ["/run.sh"]

The value pairs defined in the .env are mapped in the volumes part. Left side is the directory on the computer hosting the docker container and right side is where the contents of that folder will appear inside the docker container. :ro means that the contents of the mapped folder are read only in the container.

About

Script for automating gas flux calculations done with LI-7810.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published