rc-qlc 0.3.24__cp311-cp311-win32.whl → 0.3.27__cp311-cp311-win32.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (84) hide show
  1. qlc/cli/__init__.py +100 -9
  2. qlc/cli/installer.py +23 -5
  3. qlc/cli/qlc_main.py +54 -32
  4. qlc/cli/qlc_py_main.py +43 -38
  5. qlc/config/json/qlc_config.json +94 -10
  6. qlc/config/nml/mars_A1_sfc.nml +4 -5
  7. qlc/config/nml/mars_A3_sfc.nml +0 -1
  8. qlc/config/nml/mars_B1_pl.nml +2 -2
  9. qlc/{examples/cams_case_1/config/nml/mars_A3_sfc.nml → config/nml/mars_B1_sfc.nml} +7 -8
  10. qlc/config/nml/mars_C1_pl.nml +1 -1
  11. qlc/{examples/cams_case_1/config/nml/mars_C1_pl.nml → config/nml/mars_C1_sfc.nml} +7 -8
  12. qlc/config/nml/mars_C2_pl.nml +1 -1
  13. qlc/{examples/cams_case_1/config/qlc_cams.conf → config/qlc.conf} +80 -18
  14. qlc/{examples/cams_case_1/mod/b2ro/2018/b2ro_20181215-20181231_A3_sfc.grb → doc/CAMS_b2ro-b2rn_20181201-20181221_qlc_Z1-png_202509090814.pdf} +0 -0
  15. qlc/doc/README.md +213 -49
  16. qlc/doc/USAGE.md +266 -29
  17. qlc/examples/cams_case_1/mod/b2rn/2018/b2rn_20181201-20181221_B1_pl.grb +0 -0
  18. qlc/examples/cams_case_1/mod/b2rn/2018/b2rn_20181201-20181221_C1_sfc.grb +0 -0
  19. qlc/examples/cams_case_1/mod/b2ro/2018/b2ro_20181201-20181221_B1_pl.grb +0 -0
  20. qlc/examples/cams_case_1/mod/b2ro/2018/b2ro_20181201-20181221_C1_sfc.grb +0 -0
  21. qlc/install.py +272 -107
  22. qlc/py/__main__.cp311-win32.pyd +0 -0
  23. qlc/py/averaging.cp311-win32.pyd +0 -0
  24. qlc/py/bias_plots.cp311-win32.pyd +0 -0
  25. qlc/py/control.cp311-win32.pyd +0 -0
  26. qlc/py/io.cp311-win32.pyd +0 -0
  27. qlc/py/loadmod.cp311-win32.pyd +0 -0
  28. qlc/py/loadobs.cp311-win32.pyd +0 -0
  29. qlc/py/logging_utils.cp311-win32.pyd +0 -0
  30. qlc/py/map_plots.cp311-win32.pyd +0 -0
  31. qlc/py/matched.cp311-win32.pyd +0 -0
  32. qlc/py/plot_config.cp311-win32.pyd +0 -0
  33. qlc/py/plotting.cp311-win32.pyd +0 -0
  34. qlc/py/plugin_loader.cp311-win32.pyd +0 -0
  35. qlc/py/processing.cp311-win32.pyd +0 -0
  36. qlc/py/scatter_plots.cp311-win32.pyd +0 -0
  37. qlc/py/stations.cp311-win32.pyd +0 -0
  38. qlc/py/statistics.cp311-win32.pyd +0 -0
  39. qlc/py/style.cp311-win32.pyd +0 -0
  40. qlc/py/timeseries_plots.cp311-win32.pyd +0 -0
  41. qlc/py/utils.cp311-win32.pyd +0 -0
  42. qlc/py/version.cp311-win32.pyd +0 -0
  43. qlc/sh/qlc_A1.sh +30 -11
  44. qlc/sh/qlc_B1a.sh +1 -18
  45. qlc/sh/qlc_B2.sh +8 -1
  46. qlc/sh/qlc_C5.sh +90 -65
  47. qlc/sh/qlc_D1.sh +287 -56
  48. qlc/sh/qlc_Z1.sh +6 -6
  49. qlc/sh/qlc_batch.sh +61 -0
  50. qlc/sh/qlc_common_functions.sh +17 -29
  51. qlc/sh/qlc_main.sh +49 -26
  52. qlc/sh/tex_template/beamercolorthemeCAMS2_35.sty +51 -0
  53. qlc/sh/tex_template/beamerfontthemeCAMS2_35.sty +166 -0
  54. qlc/sh/tex_template/beamerthemeCAMS2_35.sty +25 -0
  55. qlc/sh/tex_template/subcaption.sty +170 -0
  56. qlc/sh/tex_template/template.tex +109 -0
  57. rc_qlc-0.3.27.dist-info/METADATA +309 -0
  58. rc_qlc-0.3.27.dist-info/RECORD +103 -0
  59. qlc/config/json/qlc_config_example_1a_all-obs.json +0 -237
  60. qlc/config/json/qlc_config_example_1b_all-mod.json +0 -353
  61. qlc/config/json/qlc_config_example_1c_all-coll.json +0 -266
  62. qlc/config/json/qlc_config_example_2a_all-obs.json +0 -237
  63. qlc/config/json/qlc_config_example_2b_all-mod.json +0 -353
  64. qlc/config/json/qlc_config_example_2c_all-coll.json +0 -265
  65. qlc/config/json/qlc_config_example_3a-us_obs.json +0 -82
  66. qlc/config/json/qlc_config_example_3b-us_mod.json +0 -122
  67. qlc/config/json/qlc_config_example_3c-us_coll.json +0 -46
  68. qlc/config/json/qlc_config_example_4a_eu-obs.json +0 -41
  69. qlc/config/json/qlc_config_example_4b_eu-mod.json +0 -122
  70. qlc/config/json/qlc_config_example_4c_eu-coll.json +0 -45
  71. qlc/config/qlc_cams.conf +0 -26
  72. qlc/config/qlc_test.conf +0 -26
  73. qlc/config/qlc_tex.conf +0 -107
  74. qlc/examples/cams_case_1/config/json/qlc_config.json +0 -41
  75. qlc/examples/cams_case_1/config/nml/mars_B1_pl.nml +0 -19
  76. qlc/examples/cams_case_1/mod/iqi9/2018/iqi9_20181215-20181231_A3_sfc.grb +0 -0
  77. qlc/sh/qlc_start.sh +0 -23
  78. qlc/sh/qlc_start_batch.sh +0 -46
  79. rc_qlc-0.3.24.dist-info/METADATA +0 -142
  80. rc_qlc-0.3.24.dist-info/RECORD +0 -113
  81. {rc_qlc-0.3.24.dist-info → rc_qlc-0.3.27.dist-info}/WHEEL +0 -0
  82. {rc_qlc-0.3.24.dist-info → rc_qlc-0.3.27.dist-info}/entry_points.txt +0 -0
  83. {rc_qlc-0.3.24.dist-info → rc_qlc-0.3.27.dist-info}/licenses/LICENSE +0 -0
  84. {rc_qlc-0.3.24.dist-info → rc_qlc-0.3.27.dist-info}/top_level.txt +0 -0
@@ -1,20 +1,31 @@
1
1
  #----------------------------------------------------------------------
2
- #----------------------- QLC version to be used -------------------
3
- QLC_VERSION="v03"
4
- #----------------------- Path definitions -------------------------
5
- SCRIPTS_PATH="$HOME/../cysm/bin_public/qlc_src_$QLC_VERSION"
2
+ #----------------------- QLC version to be used -----------------------
3
+ QLC_VERSION="VERSION"
4
+ #----------------------------------------------------------------------
5
+ #----------------------- Path definitions -----------------------------
6
+ #----------------------------------------------------------------------
6
7
  QLC_HOME="$HOME/qlc"
7
- QLC_DIRECTORY="${QLC_HOME}_$QLC_VERSION"
8
- WORKING_DIRECTORY="$SCRATCH/qlc"
9
- MARS_RETRIEVAL_DIRECTORY="$SCRATCH/qlc/Results"
10
- ANALYSIS_DIRECTORY="$HPCPERM/qlc/Analysis"
11
- PLOTS_DIRECTORY="$PERM/qlc/Plots"
12
- TEX_DIRECTORY="$PERM/qlc/Presentations"
13
- #----------------------- PDF presentation and info -------------
14
- TEAM_PREFIX="CAMS2_35"
8
+ DATA_PATH="${QLC_HOME}/data"
9
+ SCRIPTS_PATH="${QLC_HOME}/bin"
10
+ WORKING_DIRECTORY="${QLC_HOME}"
11
+ MARS_RETRIEVAL_DIRECTORY="${QLC_HOME}/Results"
12
+ ANALYSIS_DIRECTORY="${QLC_HOME}/Analysis"
13
+ PLOTS_DIRECTORY="${QLC_HOME}/Plots"
14
+ TEX_DIRECTORY="${QLC_HOME}/Presentations"
15
+ #----------------------------------------------------------------------
16
+ #----------------------- PDF presentation and info -------------------
17
+ #----------------------------------------------------------------------
18
+ TEAM_PREFIX="CAMS" # without underscore
15
19
  EVALUATION_PREFIX="EVAL"
16
20
  MODEL_RESOLUTION="T255L137"
17
21
  TIME_RESOLUTION="03hh"
22
+ #----------------------------------------------------------------------
23
+ # User specific configuration file
24
+ CONFIG_DIR="${QLC_HOME}/config"
25
+ CONFIG_TEX="$CONFIG_DIR/qlc_tex.conf"
26
+ #----------------------------------------------------------------------
27
+ #----------------------- PDF presentation and info -------------------
28
+ #----------------------------------------------------------------------
18
29
  #PLOTEXTENSION="pdf"
19
30
  PLOTEXTENSION="png"
20
31
  #----------------------- Run-time definitions -------------------------
@@ -23,15 +34,15 @@ PLOTEXTENSION="png"
23
34
  #- (a) QLC unified data analysis and plotting (entries optional)
24
35
  #----------------------------------------------------------------------
25
36
  #SUBSCRIPT_NAMES=("A1" "B1" "B2" "C1" "D1" "E1" "F1" "G1" "Z1")
26
- #SUBSCRIPT_NAMES=("C5" "Z1")
27
- SUBSCRIPT_NAMES=("A1" "B1a" "B2" "C5" "Z1")
37
+ SUBSCRIPT_NAMES=("A1" "B1a" "B2" "C5" "D1" "Z1")
38
+ #SUBSCRIPT_NAMES=("D1" "Z1")
28
39
  #----------------------------------------------------------------------
29
40
  #- (b) QLC unified mars data retrieval (SUBSCRIPT_NAME, A1, A2, A3, ...)
30
41
  #- Mars retrievals for namelist : nml/mars_A2.nml, nml/mars_B2.nml, ...)
31
42
  #----------------------------------------------------------------------
32
- #- MARS_RETRIEVALS=("A2_sfc" "B2_pl" "C2_pl" "C3_ml" "D" "E" "F" "I")
33
- #- O3, NH3 and NH4_as
34
- MARS_RETRIEVALS=("A3_sfc" "B1_pl" "C1_pl")
43
+ #- MARS_RETRIEVALS=("A3_sfc" "B1_pl" "C1_pl" "C1_ml" "D" "E" "F" "I")
44
+ #- "NH3" "NH4-as"
45
+ MARS_RETRIEVALS=("B1_pl" "C1_sfc" )
35
46
  #----------------------------------------------------------------------
36
47
  #- un/comment MARS_RETRIEVALS (choose one or combine contents into one)
37
48
  #- The MARS_RETRIEVALS mapping is required for subscript processing (a)
@@ -57,6 +68,14 @@ param_A1_sfc=("73.210")
57
68
  ncvar_A1_sfc=("var73")
58
69
  myvar_A1_sfc=("PM25")
59
70
  #----------------------------------------------------------------------
71
+ param_B1_sfc=("19.217")
72
+ ncvar_B1_sfc=("nh3")
73
+ myvar_B1_sfc=("NH3")
74
+ #----------------------------------------------------------------------
75
+ param_C1_sfc=("35.212")
76
+ ncvar_C1_sfc=("param35.212.192")
77
+ myvar_C1_sfc=("NH4_as")
78
+ #----------------------------------------------------------------------
60
79
  param_A2_sfc=("207.210" "72.210" "73.210" "74.210")
61
80
  ncvar_A2_sfc=("var207" "var72" "var73" "var74")
62
81
  myvar_A2_sfc=("AOD" "PM1" "PM25" "PM10")
@@ -119,4 +138,47 @@ param_I=("130" "133" "157")
119
138
  ncvar_I=("var130" "var133" "var157")
120
139
  myvar_I=("T" "SH" "RH")
121
140
  #----------------------------------------------------------------------
122
- #----------------------------------------------------------------------
141
+ #- 3. Resolution depending definitions (to be processed by subscripts)
142
+ #----------------------------------------------------------------------
143
+ UTLS="4:5" # 100:300 hPa (selected model levels)
144
+ #----------------------------------------------------------------------
145
+ # Additional settings for qlc-py execution via qlc_D1.sh
146
+ # These are required to generate the correct JSON configuration.
147
+ #----------------------------------------------------------------------
148
+ # Full path to the station list file.
149
+ # Leave empty if not used.
150
+ STATION_FILE="${QLC_HOME}/obs/data/ebas_station-locations.csv"
151
+ # Path to the root directory containing observation data.
152
+ # The install script links the example data to ../obs from the test/bin directory.
153
+ OBS_DATA_PATH="${QLC_HOME}/obs/data/ver0d"
154
+ # Type of observation dataset (e.g., ebas_daily).
155
+ OBS_DATASET_TYPE="ebas_daily"
156
+ # Version of the observation dataset (e.g., latest).
157
+ OBS_DATASET_VERSION="latest"
158
+ # Name of the model being evaluated.
159
+ MODEL="IFS"
160
+ # Comma-separated list of labels for the experiments, in the same order.
161
+ # Used for plot legends.
162
+ EXP_LABELS="E4C,REF"
163
+ # The geographical region for plotting.
164
+ REGION="EU"
165
+ # The model level to be used for analysis.
166
+ # A single integer might be provided (e.g., 9).
167
+ # If unset, the Python code will default to the surface level for all variables.
168
+ MODEL_LEVEL=""
169
+ # The specific plot type to generate.
170
+ # Leave empty for default behavior.
171
+ PLOT_TYPE=""
172
+ # The time averaging to be applied (e.g., daily, monthly).
173
+ TIME_AVERAGE="daily"
174
+ # The radius in degrees to search for model points around a station.
175
+ STATION_RADIUS_DEG=0.5
176
+ # How many stations to group into a single plot.
177
+ STATION_PLOT_GROUP_SIZE=5
178
+ # Enable or disable multiprocessing.
179
+ MULTIPROCESSING=false
180
+ # Number of threads to use if multiprocessing is enabled.
181
+ N_THREADS=4
182
+ # Enable or disable debug mode.
183
+ DEBUG=false
184
+ #----------------------------------------------------------------------
qlc/doc/README.md CHANGED
@@ -1,7 +1,8 @@
1
- # Quick Look Content (QLC): Model–Observation Comparison Suite for Use with CAMS
1
+ # Quick Look Content (QLC): An Automated Model–Observation Comparison Suite
2
2
 
3
- `qlc` is a single command-line tool for model–observation comparisons with automated figures and summaries,
4
- designed to support climate and air quality monitoring and specifically adapted for use with CAMS (Copernicus Atmospheric Monitoring Service) datasets.
3
+ **Quick Look Content (QLC)** is a powerful, command-line driven suite for model–observation comparisons, designed to automate the evaluation of climate and air quality model data. It is optimized for use with CAMS (Cop Copernicus Atmospheric Monitoring Service) datasets but is flexible enough for general use cases.
4
+
5
+ The suite streamlines the entire post-processing workflow, from data retrieval and collocation to statistical analysis and the generation of publication-quality figures and reports.
5
6
 
6
7
  | Package | Status |
7
8
  |---------|--------|
@@ -9,54 +10,160 @@ designed to support climate and air quality monitoring and specifically adapted
9
10
 
10
11
  ---
11
12
 
12
- ## Features
13
+ ## What's New in v0.3.27
14
+
15
+ This release focuses on improving the out-of-the-box installation experience, especially for HPC environments, and significantly expanding the user documentation.
13
16
 
14
- - Side-by-side evaluation of observational and modelled data
15
- - Fully scriptable and automated post-processing chain
16
- - Modular structure using shell + Python + Cython
17
- - Generates publication-ready figures and LaTeX integration
18
- - Supports NetCDF and CSV time series formats
19
- - Pre-configured CAMS observational interface via JSON
17
+ - **Installer Overhaul**: The `qlc-install` script is now more robust.
18
+ - It automatically creates the `qlc` -> `qlc_latest` -> `qlc_vX.Y.Z/<mode>` symlink structure, removing the need for manual setup.
19
+ - It now provides clear, actionable instructions on how to update your `PATH` if needed.
20
+ - **Enhanced HPC & Batch Job Support**:
21
+ - The batch submission script (`sqlc`) is more reliable, no longer using hardcoded paths.
22
+ - Shell scripts are now more compatible with typical HPC environments that may only have a `python3` executable.
23
+ - **Expanded Documentation**:
24
+ - The `USAGE.md` guide now includes comprehensive, exhaustive lists of currently available plotting regions, observation datasets, and supported chemical/meteorological variables.
25
+ - A new "Advanced Workflow" section has been added to `USAGE.md`, explaining the underlying shell script pipeline, the `param/ncvar/myvar` variable mapping system, and how to use your own data with the `qlc-py` engine.
26
+ - Added a note on the future integration with the GHOST database.
27
+ - **Dependency Fix**: The `adjustText` library is now included as a core dependency.
20
28
 
21
29
  ---
22
30
 
23
- ## User Installation
31
+ ## What's New in v0.3.26
32
+
33
+ This version introduces a completely new, high-performance Python processing engine and a more robust installation system.
34
+ - **New Python Engine (`qlc-py`)**: The core data processing and plotting is now handled by a powerful Python-based tool, compiled with Cython for maximum performance. This replaces much of the previous shell-script-based logic.
35
+ - **Standalone `qlc-py` Tool**: In addition to being used by the main `qlc` pipeline, `qlc-py` can be run as a standalone tool for rapid, iterative analysis using a simple JSON configuration.
36
+ - **New `cams` Installation Mode**: A dedicated installation mode for operational CAMS environments that automatically links to standard data directories.
37
+ - **Simplified and Robust Installation**: The installer now uses a consistent directory structure based in `$HOME/qlc`, with a smart two-stage symlink system to manage data-heavy directories for different modes (`test` vs. `cams`).
38
+ - **Dynamic Variable Discovery**: The shell pipeline now automatically discovers which variables to process based on the available NetCDF files, simplifying configuration.
39
+ - **Flexible Model Level Handling**: The Python engine can intelligently select the correct vertical model level for each variable or use a user-defined default.
40
+
41
+ ---
42
+
43
+ ## Core Features
44
+
45
+ - **Automated End-to-End Workflow**: A single `qlc` command can drive the entire pipeline: MARS data retrieval, data processing, statistical analysis, plotting, and final PDF report generation.
46
+ - **High-Performance Engine**: The core data processing logic is written in Python and compiled with Cython into native binary modules, ensuring high performance for large datasets.
47
+ - **Publication-Ready Outputs**: Automatically generates a suite of plots (time series, bias, statistics, maps) and integrates them into a final, professionally formatted PDF presentation using a LaTeX backend.
48
+ - **Flexible Installation Modes**: The `qlc-install` script supports multiple, co-existing modes:
49
+ - `--mode test`: A standalone mode with bundled example data, perfect for new users. All data is stored locally in `$HOME/qlc_v<version>/test/`.
50
+ - `--mode cams`: An operational mode that links to standard CAMS data directories and uses environment variables like `$SCRATCH` and `$PERM` for data storage in shared HPC environments.
51
+ - **Simplified Configuration**: The entire suite is controlled by a single, well-documented configuration file (`$HOME/qlc/config/qlc.conf`) where you can set paths, experiment labels, and plotting options.
52
+
53
+ ---
24
54
 
25
- Use one of the following install modes:
55
+ ## Quickstart
26
56
 
57
+ **1. Install the Package**
27
58
  ```bash
28
- # Option 1: CAMS (default data links + config)
29
- pip install rc-qlc && qlc-install --cams
59
+ pip install rc-qlc
60
+ ```
30
61
 
31
- # Option 2: Local test mode with embedded examples
32
- pip install rc-qlc && qlc-install --test
62
+ **2. Set Up the Test Environment**
63
+ This creates a local runtime environment in `$HOME/qlc_v<version>/test` and links `$HOME/qlc` to it. It includes all necessary configurations and example data.
64
+ ```bash
65
+ qlc-install --mode test
66
+ ```
33
67
 
34
- # Option 3: Custom interactive mode
35
- pip install rc-qlc && qlc-install --interactive="./path/to/qlc_user.conf"
68
+ **3. Run the Full Pipeline**
69
+ Navigate to the working directory and run the `qlc` command. This will process the example data (comparing experiments `b2ro` and `b2rn`) and generate a full PDF report in `$HOME/qlc/Presentations`.
70
+ ```bash
71
+ cd $(readlink -f $HOME/qlc)
72
+ qlc b2ro b2rn 2018-12-01 2018-12-21
36
73
  ```
37
74
 
38
75
  ---
39
76
 
40
- ## Example Use Cases
77
+ ## Prerequisites
78
+
79
+ Before running the QLC suite, please ensure the following system-level software is installed and accessible in your environment's `PATH`:
80
+
81
+ - **`pdflatex`**: Required for generating the final PDF reports. It is part of the **TeX Live** distribution.
82
+ - **`CDO` (Climate Data Operators)**: Used for processing NetCDF data.
83
+ - **`eccodes`**: The ECMWF library for decoding and encoding GRIB files.
84
+ - **`netcdf`**: The core NetCDF libraries.
85
+
86
+ On HPC systems, these tools are typically made available by loading the appropriate modules (e.g., `module load cdo`). On personal machines, they can be installed using system package managers like `apt-get` (Debian/Ubuntu), `yum` (Red Hat/CentOS), or `brew` (macOS).
87
+
88
+ ---
89
+
90
+ ## Installation and Configuration
91
+
92
+ ### Standard Installation
41
93
 
42
- ### Run the full shell pipeline (retrieval, processing, plotting):
94
+ QLC is installed from PyPI. After the `pip install`, you **must** run `qlc-install` to set up the necessary local directory structure.
95
+
96
+ **First-Time Installation**
43
97
  ```bash
44
- qlc
98
+ pip install rc-qlc
45
99
  ```
46
100
 
47
- ### Run just the observation/model comparison in Python:
101
+ **Upgrading an Existing Installation**
102
+ To ensure you have the latest version, always use the `--upgrade` flag:
48
103
  ```bash
49
- qlc-py
104
+ pip install --upgrade rc-qlc
50
105
  ```
51
106
 
52
- ### Submit via batch system (e.g., SLURM or LSF):
107
+ After installing, set up your desired environment:
108
+ ```bash
109
+ # For a standalone test environment with example data
110
+ qlc-install --mode test
111
+
112
+ # For an operational CAMS environment
113
+ qlc-install --mode cams
114
+ ```
115
+
116
+ ### Installation in Restricted Environments (HPC/ATOS)
117
+
118
+ In environments where you do not have root permissions, `pip` will install packages into your local user directory. You may need to take a couple of extra steps.
119
+
120
+ **1. Update your PATH (Recommended)**
121
+ The executable scripts (`qlc`, `qlc-py`, etc.) will be placed in `$HOME/.local/bin`. Add this to your shell's `PATH` to run them directly.
122
+ ```bash
123
+ # Example for bash shell
124
+ echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.bashrc
125
+ source ~/.bashrc
126
+ ```
127
+
128
+ **2. Load the Correct Python Module**
129
+ Ensure you are using a compatible Python version.
130
+ ```bash
131
+ module load python3/3.10.10-01
132
+ ```
133
+
134
+ **3. Install and Run**
135
+ Now you can install as normal.
136
+ ```bash
137
+ pip install rc-qlc && qlc-install --mode test
138
+ ```
139
+ If you chose not to update your `PATH`, you must call the installer script by its full path:
53
140
  ```bash
54
- sqlc
141
+ pip install rc-qlc && $HOME/.local/bin/qlc-install --mode test
55
142
  ```
56
143
 
144
+ ### Where Files Are Installed
145
+ - **Python Package Source**: `$HOME/.local/lib/python3.10/site-packages/qlc/`
146
+ - **Executable Scripts**: `$HOME/.local/bin/`
147
+ - **QLC Runtime Environment**: `$HOME/qlc_v<version>/<mode>`
148
+ - **Stable Symlink**: `$HOME/qlc` (points to the latest installed runtime environment)
149
+
150
+
151
+ ### Configuration Structure
152
+
153
+ The primary configuration file is located at `$HOME/qlc/config/qlc.conf`. The installation process uses a two-stage symlink system to manage data directories, allowing the config file to remain simple and portable.
154
+
155
+ For example, in `test` mode:
156
+ - `$HOME/qlc/Results` (the path in your config) -> is a symlink to
157
+ - `$HOME/qlc_v<version>/test/Results` -> which is a symlink to
158
+ - `$HOME/qlc_v<version>/test/data/Results` -> which is a real directory.
159
+
160
+ In `cams` mode, the final target is a symlink to a shared directory (e.g., `$SCRATCH/Results`), but the path in your config file remains the same.
161
+
162
+ ---
163
+
57
164
  ## Developer Setup
58
165
 
59
- To work on the `qlc` source code, clone the repository and install it in "editable" mode. This will install all dependencies and link the `qlc` command to your source tree.
166
+ To work on the `qlc` source code, clone the repository and install it in "editable" mode.
60
167
 
61
168
  ```bash
62
169
  # 1. Clone the repository
@@ -67,43 +174,100 @@ cd qlc
67
174
  python3 -m venv .venv
68
175
  source .venv/bin/activate
69
176
 
70
- # 3. Install in editable mode
177
+ # 3. Install in editable mode (this compiles the Cython modules)
71
178
  pip install -e .
179
+
180
+ # 4. Set up the test environment for development
181
+ qlc-install --mode test
72
182
  ```
73
183
 
74
- ---
184
+ For advanced development, you can also use `--mode interactive`, which requires you to provide a path to a custom configuration file using the `--config` flag. This is useful for testing with non-standard setups.
185
+ ```bash
186
+ qlc-install --mode interactive --config /path/to/your/custom_qlc.conf
187
+ ```
188
+
189
+ ## Advanced Topics
190
+
191
+ ### Installing PyFerret for Global Plots
192
+
193
+ The `qlc_C5.sh` script, which generates global map plots, requires the `pyferret` library. This is an optional dependency.
194
+
195
+ - **To install with `pyferret` support:**
196
+ ```bash
197
+ pip install "rc-qlc[ferret]"
198
+ ```
199
+ - **If you do not need these plots**, you can either skip the `pyferret` installation or, if it's already installed, disable the script by commenting out `"C5"` in the `SUBSCRIPT_NAMES` array in your `$HOME/qlc/config/qlc.conf` file.
200
+ - **For HPC environments**, `pyferret` is often available as a module that can be loaded (e.g., `module load ferret/7.6.3`).
75
201
 
76
- ## Configuration Structure
202
+ ### Manual PyFerret Installation for macOS / Apple Silicon
77
203
 
78
- The installer script creates the following structure in your home directory:
204
+ If you are using a Mac with Apple Silicon (M1/M2/M3) or if the standard installation fails, `pyferret` may require a manual setup using a dedicated `conda` environment. `pip` installations are not recommended for this package on macOS as they may not work correctly with the ARM architecture.
205
+
206
+ The most reliable method is to use `conda` with the Rosetta 2 translation layer.
207
+
208
+ **1. (If needed) Install Conda**
209
+ If you do not have `conda` installed, we recommend **Miniforge**, which is a minimal installer that is optimized for Apple Silicon and includes the high-performance `mamba` package manager.
210
+ ```bash
211
+ # Download and run the installer for Apple Silicon
212
+ curl -L -O "https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-MacOSX-arm64.sh"
213
+ bash Miniforge3-MacOSX-arm64.sh
214
+ # Follow the prompts and restart your terminal after installation
79
215
  ```
80
- $HOME/qlc_v<version>/
81
- ├── test/ # Root directory for the 'test' installation mode
82
- │ ├── bin/ # Symlinks to shell scripts
83
- │ ├── doc/ # Symlinks to documentation
84
- │ ├── config/ # Active config files (e.g., qlc.conf)
85
- │ ├── examples/ # Test input and output files
86
- │ ├── obs/, mod/, ... # Runtime directories
87
- │ └── VERSION.json # Tracks install mode and version
88
- └── cams/ # Root for 'cams' mode, etc.
216
+
217
+ **2. Create a Dedicated x86_64 Environment for PyFerret**
218
+ This command creates a new `conda` environment named `pyferret_env` and installs the Intel (`x86_64`) version of `pyferret`, which will run seamlessly on Apple Silicon via Rosetta 2. It also pins `numpy` to a version older than 2.0 to ensure compatibility.
219
+
220
+ ```bash
221
+ CONDA_SUBDIR=osx-64 conda create -n pyferret_env -c conda-forge pyferret ferret_datasets "numpy<2" --yes
89
222
  ```
90
- A symlink `$HOME/qlc` is also created to point to the active installation. You can edit `$HOME/qlc/config/qlc.conf` to modify runtime behavior.
91
223
 
92
- ---
224
+ **3. Configure QLC to Use the New Environment**
225
+ The QLC scripts need to know where to find this new `pyferret` installation. You can achieve this by modifying the `qlc_C5.sh` script to activate the environment.
93
226
 
94
- ## Documentation
227
+ Open the file `$HOME/qlc/sh/qlc_C5.sh` and add the following lines near the top, after `source $FUNCTIONS`:
95
228
 
96
- - All core logic is contained in the `qlc` package.
97
- - Shell scripts for driving the pipeline are in `qlc/sh/`.
98
- - The core Python/Cython logic is in `qlc/py/*.py` and is compiled to binary modules for performance.
229
+ ```bash
230
+ # ... after 'source $FUNCTIONS'
231
+ # Activate the dedicated conda environment for pyferret
232
+ if [ -f "$HOME/miniforge3/bin/activate" ]; then
233
+ . "$HOME/miniforge3/bin/activate"
234
+ conda activate pyferret_env
235
+ fi
236
+ # ... rest of the script
237
+ ```
238
+ *Note: The path to the activate script may differ if you installed Anaconda/Miniforge in a custom location.*
239
+
240
+ ### MARS Data Retrieval
241
+ The `qlc_A1.sh` script is responsible for retrieving data from the ECMWF MARS archive. It uses a mapping system to associate the experiment prefix with a MARS `class`.
242
+
243
+ By default, the script is configured for `nl` (Netherlands), `be` (Belgium), and `rd` (Research Department) experiments. If you are working with data from other classes (e.g., `fr` for France, `de` for Germany), you will need to manually edit `$HOME/qlc/sh/qlc_A1.sh` and uncomment / edit the corresponding `XCLASS` line to ensure data is retrieved correctly.
99
244
 
100
245
  ---
101
246
 
102
- ## Developer Notes
247
+ ## Troubleshooting
248
+
249
+ ### macOS "Permission Denied" or Quarantine Issues
250
+
251
+ On macOS, the Gatekeeper security feature may "quarantine" files, including shell scripts that have been downloaded or modified. This can prevent them from being executed, sometimes with a "Permission Denied" error, even if the file has the correct execute permissions (`+x`).
252
+
253
+ This is most likely to occur if you manually edit the `qlc` shell scripts (`.sh` files) directly in their `site-packages` installation directory.
254
+
255
+ To resolve this, you can manually remove the quarantine attribute from the script directory using the `xattr` command in your terminal.
256
+
257
+ 1. **First, find the exact location of the `qlc` package:**
258
+ ```bash
259
+ pip show rc-qlc
260
+ ```
261
+ Look for the `Location:` line in the output. This is your `site-packages` path.
262
+
263
+ 2. **Then, use the `xattr` command to remove the quarantine flag:**
264
+ Use the path from the previous step to build the full path to the `qlc/sh` directory.
265
+ ```bash
266
+ # The path will depend on your Python installation. Use the location from 'pip show'.
267
+ xattr -rd com.apple.quarantine /path/to/your/site-packages/qlc/sh/
268
+ ```
103
269
 
104
- - Python source files (`.py`) are compiled to binary modules (`.so`) using Cython at install time.
105
- - The package version is managed in `pyproject.toml`.
106
- - The `qlc-install` script sets up the runtime environment by creating directories and symlinks.
270
+ This should immediately resolve the execution issues.
107
271
 
108
272
  ---
109
273