From 63a1f4d0031429a99595f78b979d04800e5c3a74 Mon Sep 17 00:00:00 2001
From: Olivier Sauter <olivier.sauter@epfl.ch>
Date: Tue, 11 Feb 2025 09:12:08 +0100
Subject: [PATCH] add comments for unit and long_name

---
 matlab/CHDF/cdf2mat.m | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/matlab/CHDF/cdf2mat.m b/matlab/CHDF/cdf2mat.m
index 1deaca82..da2dac52 100644
--- a/matlab/CHDF/cdf2mat.m
+++ b/matlab/CHDF/cdf2mat.m
@@ -61,6 +61,7 @@ for i=1:length(coordnames_sorted)
     for ij=1:length(fields_variables_to_copy)
       matcdf.coords(i).(fields_variables_to_copy{ij}) = allinfo.Variables(matcdf.coords(i).index_allvarnames).(fields_variables_to_copy{ij});
     end
+    % define defaults before fetching the values in Attributes (if provided)
     matcdf.coords(i).units = '';
     matcdf.coords(i).long_name = [matcdf.coords(i).name ' empty'];
     for jj=1:numel(allinfo.Variables(matcdf.coords(i).index_allvarnames).Attributes)
@@ -97,6 +98,7 @@ for i=1:length(varnames_sorted)
     for ij=1:length(fields_variables_to_copy)
       matcdf.vars(i).(fields_variables_to_copy{ij}) = allinfo.Variables(matcdf.vars(i).index_allvarnames).(fields_variables_to_copy{ij});
     end
+    % define defaults before fetching the values in Attributes (if provided)
     matcdf.vars(i).units = '';
     matcdf.vars(i).long_name = [matcdf.vars(i).name ' empty'];
     for jj=1:numel(allinfo.Variables(matcdf.vars(i).index_allvarnames).Attributes)
-- 
GitLab