-
Notifications
You must be signed in to change notification settings - Fork 2
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
Conversation
…tained a few simple functions.
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..."); | ||
} |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
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