Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Two or more singleton dimensions (bs550aer) #464

Closed
kjoti opened this issue Apr 1, 2019 · 2 comments
Closed

Two or more singleton dimensions (bs550aer) #464

kjoti opened this issue Apr 1, 2019 · 2 comments

Comments

@kjoti
Copy link
Contributor

kjoti commented Apr 1, 2019

Hi, i am koji.

The problem occurs in the following cases:

  1. The variable has two or more singleton dimensions
  2. Users omit the 'axes_ids' of these singleton dimensions when invoking cmor_variable()

CMOR automatically adds the singleton dimensions if needed,
so omitting them is allowed and very common.

It's easy to fix this problem. Apply the following patch:

diff --git a/Src/cmor_variables.c b/Src/cmor_variables.c
index 24ca3ff..dc67faa 100644
--- a/Src/cmor_variables.c
+++ b/Src/cmor_variables.c
@@ -1533,7 +1533,7 @@ int cmor_variable(int *var_id, char *name, char *units, int ndims,
                                   1, &pAxis->value, 'd', NULL, 0, "");
                     }
 
-                    laxes_ids[olndims] = k;
+                    laxes_ids[olndims + lndims] = k;
                     lndims += 1;
                 }

'olndims' does not change while looping and 'lndims' is incremented
(starting with zero). So in the case of only one singleton dimension,
the previous code is ok.
But generally the index of 'laxes_ids' should be 'olndims + lndims'.

@mauzey1
Copy link
Collaborator

mauzey1 commented Apr 2, 2019

@kjoti
Hi Koji. Thank you for helping solve this problem.

Could you submit these changes as a pull request to our repo's master branch? You can do this by making a fork of this repo, making changes in your fork, and submitting a pull request to merge your fork's branch into ours. This makes it easier to track changes provided by contributors to this project.

Thank you,

Chris

@kjoti
Copy link
Contributor Author

kjoti commented Apr 4, 2019

@mauzey1
Please check #468

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants