This repository contains the codebase for a data exchange service designed to facilitate communication between the Earth System Model (E3SM) and the Cyberwater client. It also includes a Python-based middleman server to manage the data exchange.
To set up the E3SM Client, ensure the following requirements are met:
stdio.h
, stdlib.h
, string.h
libcurl
library required for the C wrapper code (http_impl.c
):
curl -O https://curl.se/download/curl-7.79.1.tar.gz
tar -xzvf curl-7.79.1.tar.gz
cd curl-7.79.1
./configure --prefix=/home/your_username/local
make
make install
libcurl
:
export PATH="/home/your_username/local/bin:$PATH"
export LD_LIBRARY_PATH="/home/your_username/local/lib:$LD_LIBRARY_PATH"
export PKG_CONFIG_PATH="/home/your_username/local/lib/pkgconfig:$PKG_CONFIG_PATH"
curl --version
Ensure the following requirements are met for the Data Exchange Service:
python3 -m venv exchange_env
source exchange_env/bin/activate
pip install fastapi==0.110.1 uvicorn==0.29.0 pydantic==2.7.0
The Cyberwater client requires the same Python version as the Data Exchange Service:
To validate the functionality of the data exchange system, you need to test the server, the Cyberwater client, and the E3SM client as follows:
Navigate to the directory containing exchange_server.py
. Start the server by running the following command:
python exchange_server.py
This will start the server on your local machine, listening on port 8000. (default, you can change it according to the client requirements).
Perform the following steps on the remote machine set up as the Cyberwater client:
To run the Cyberwater client, execute:
python cyberwater_test.py
This will initiate or join a session and start the data exchange process.
Follow these steps on a different remote machine intended as the E3SM client:
data_exchange_lib
directory contains http_impl.c
, http_interface.f90
, and data_exchange.f90
.e3sm_test.f90
and the Makefile.Compile the E3SM client code with the following commands:
make clean
make
After compilation, run the E3SM client:
./e3sm_test
This will execute the compiled binary and engage in the data exchange process with the server and the Cyberwater client.
Both clients will interact with the data exchange server, which handles sessions, flags, and data transmission. Use the following endpoints to manage and monitor sessions:
/create_session
: Initiates a new session./join_session
: Joins an existing session./print_all_session_statuses
: Prints list of all current sessions and their statuses./print_all_variable_flags
: Retrieves the flag status of all variables in a session./get_variable_flag
: Gets the flag status for a specific variable./get_variable_size
: Fetches the size of a specific variable./send_data
: Sends binary data for a specific variable./receive_data
: Receives binary data for a specific variable./end_session
: Ends a session.