diff --git a/README.md b/README.md index fa20e78..db30fc6 100644 --- a/README.md +++ b/README.md @@ -89,6 +89,38 @@ relative_humidity: ``` +# How to Extend DIMA’s File Reading Capabilities for New Instruments + +We now explain how to extend DIMA's file-reading capabilities by adding support for a new instrument. The process involves adding instrument-specific files and registering the new instrument's file reader. + +## 1. Create Instrument Files +You need to add two files for the new instrument: + +- A **YAML file** that contains the instrument-specific description terms. + - **Location**: `instruments/dictionaries/` + +- A **Python file** that reads the instrument's data files (e.g., JSON files). + - **Location**: `instruments/readers/` + +**Example:** +- **YAML file**: `ACSM_TOFWARE_flags.yaml` +- **Python file**: `flag_reader.py` (reads `flag.json` files from the new instrument). + +## 2. Register the New Instrument Reader +To enable DIMA to recognize the new instrument's file reader, update the **filereader registry**: + +1. Open the file: `instruments/readers/filereader_registry.py`. +2. Add an entry to register the new instrument's reader. + +**Example:** +```python +# Import the new reader +from instruments.readers.flag_reader import read_jsonflag_as_dict +# Register the new instrument in the registry +file_extensions.append('.json') +file_readers.update({'ACSM_TOFWARE_flags_json' : lambda x: read_jsonflag_as_dict(x)}) +``` + ## ------------------- ## Getting started @@ -96,9 +128,6 @@ To make it easy for you to get started with GitLab, here's a list of recommended Already a pro? Just edit this README.md and make it your own. Want to make it easy? [Use the template at the bottom](#editing-this-readme)! -## TODO -* Talk to Thorsten about rga txt files. Example folder contains incosistent rga txt files, there is no unique column separator (, or ) - ## Add your files - [ ] [Create](https://docs.gitlab.com/ee/user/project/repository/web_editor.html#create-a-file) or [upload](https://docs.gitlab.com/ee/user/project/repository/web_editor.html#upload-a-file) files diff --git a/TODO.md b/TODO.md new file mode 100644 index 0000000..8e5e71b --- /dev/null +++ b/TODO.md @@ -0,0 +1,3 @@ +## TODO +* Improve file reader for rga txt files (Talk to Thorsten). Example folder contains incosistent rga txt files, there is no unique column separator (, or ). +* Improve documentation of file reader extensions. Specify PY file reader template with expect input and output and file naming convention.