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

Refactored AtlasProcessor class to UtilsAtlas functions file #8

Merged
merged 2 commits into from
Aug 11, 2023

Conversation

phlndrwd
Copy link
Collaborator

Due to the small size and simplicity of the AtlasProcessor class, it has been changed into a simple UtilsAtlas functions file.

Current test outputs: http://fcm1/cylc-review/taskjobs/punderwo/?suite=monio_refactor_atlasprocessor

@phlndrwd phlndrwd self-assigned this Aug 11, 2023
@phlndrwd phlndrwd merged commit af2ae38 into develop Aug 11, 2023
2 checks passed
Comment on lines +113 to +133
atlas::util::Config atlasOptions = atlas::option::name(field.name()) |
atlas::option::levels(field.levels()) |
atlas::option::global(0);

atlas::array::DataType atlasType = field.datatype();
const auto& functionSpace = field.functionspace();
atlas::Field globalField;
switch (atlasType.kind()) {
case atlasType.KIND_REAL64:
globalField = functionSpace.createField<double>(atlasOptions);
break;
case atlasType.KIND_REAL32:
globalField = functionSpace.createField<float>(atlasOptions);
break;
case atlasType.KIND_INT32:
globalField = functionSpace.createField<int>(atlasOptions);
break;
default:
utils::throwException("AtlasProcessor::getGlobalFieldSet())> "
"Data type not coded for...");
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As a side note - it is possible to do (perhaps you knew already in which case pls ignore):

atlas::Field f = fs.createField(atlas::option::name(field.name() |
                                atlas::option::levels(field.levels) |
                                atlas::option::global(0) |
                                atlas::option::datatype(field.datatype()));    // added line

(where fs is a functionspace)
Although I can see how it might be useful to catch the data types not coded for in the rest of the code.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't know that! Thanks for the tip.

@phlndrwd phlndrwd deleted the feature/refactor_atlasprocessor branch August 16, 2023 12:37
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

Successfully merging this pull request may close these issues.

2 participants