# 0) Start clean and load Miniforge (gives you conda/mamba)
module purge
module load python3/miniforge3

# 1) Ensure conda is “hooked” in this shell (some clusters need this)
eval "$($CONDA_EXE shell.bash hook)"

# 2) Activate your env (if you already have one) OR create a fresh one
# If you already have base_plus and want to use it:
conda activate base_plus || true
# If that env doesn't exist for the 'instru' account, just make a new one:
if ! conda env list | grep -q '^disdro'; then
  conda create -y -n disdro -c conda-forge python=3.10 netcdf4 cftime numpy
fi
conda activate disdro  # or: conda activate base_plus

# 3) If you chose base_plus, add the missing packages there:
# conda install -y -n base_plus -c conda-forge netcdf4 cftime

# 4) Re-run your check
python3 - <<'PY'
from netCDF4 import Dataset
import numpy as np
p = "/station/instruments/disdrodb/PAR001_UQAM_PK/2025/202509/PAR001_UQAM_PK_20250904.nc"
with Dataset(p) as ds:
    v = ds.variables.get("sensor_temperature")
    n = len(ds.dimensions["time"])
    if v is None:
        print("sensor_temperature missing")
    else:
        arr = v[:]
        pct_nan = 100.0*np.isnan(arr).sum()/arr.size
        print(f"{p}: time={n}, sensor_temperature NaN={pct_nan:.1f}%")
PY

