import os
import sys
import lipd

# import pythonAdapter, assumes in ../python-adapter/
tests_dir = os.path.dirname(os.path.realpath(__file__))
fc_dir = os.path.dirname(tests_dir)
python_adapter_dir = os.path.join(fc_dir, "python-adapter")
sys.path.append(python_adapter_dir)

import adapter


def fake_model(adapter):
    # check to see inside function
    print("\n---\nStart of the fake_model function\n---\n")

    # the parameters are handed to you by the adapter
    files = adapter.get_files()

    # use the parameters given by the adapter to get the binary data of the LiPD file
    lipd.readLipd(files['weldeab'])

    # get the binary data of the NetCDF file
    net_cdf_path = files['net_cdf']

    # mark the NetCDF file as an output file
    adapter.set_output_files(net_cdf_path)
    adapter.set_output_files("lipd-files\\")

    return

# have to call adapter in the adapter.py file as adapter.adapter
adapter = adapter.global_adapter

adapter.register(fake_model)
adapter.start_server()

[(7, 'os.path.dirname', 'os.path.dirname', False, 'import os\n'), (8, 'os.path.join', 'os.path.join', False, 'import os\n'), (9, 'sys.path.append', 'sys.path.append', False, 'import sys\n'), (36, 'adapter.register', 'adapter.register', False, 'import adapter\n'), (37, 'adapter.start_server', 'adapter.start_server', False, 'import adapter\n'), (6, 'os.path.realpath', 'os.path.realpath', False, 'import os\n'), (19, 'adapter.get_files', 'adapter.get_files', False, 'import adapter\n'), (22, 'lipd.readLipd', 'lipd.readLipd', False, 'import lipd\n'), (28, 'adapter.set_output_files', 'adapter.set_output_files', False, 'import adapter\n'), (29, 'adapter.set_output_files', 'adapter.set_output_files', False, 'import adapter\n')]