Skip to content

Commit

Permalink
#1815 Formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
Howard Soh committed Jun 23, 2022
1 parent ca77ab2 commit 9483883
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 21 deletions.
32 changes: 13 additions & 19 deletions src/libcode/vx_data2d_nccf/var_info_nccf.cc
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,8 @@ void VarInfoNcCF::clear() {
return;
}

///////////////////////////////////////////////////////////////////////////////

void VarInfoNcCF::clear_dimension() {
Dimension.clear();
Is_offset.clear();
Expand Down Expand Up @@ -188,32 +190,27 @@ void VarInfoNcCF::set_magic(const ConcatString &nstr, const ConcatString &lstr)
// If dimensions are specified, clear the default value
if (strchr(ptr, ',') != NULL) clear_dimension();

bool as_offset = true;
// Parse the dimensions
while ((ptr2 = strtok_r(ptr, ",", &save_ptr)) != NULL)
{
bool as_offset = true;
while ((ptr2 = strtok_r(ptr, ",", &save_ptr)) != NULL) {
// Check for wildcards
if (strchr(ptr2, '*') != NULL) {
add_dimension(vx_data2d_star);
if (strchr(ptr2, '*') != NULL) { add_dimension(vx_data2d_star);
}
else
{
else {
as_offset = (*ptr2 != '@');
if (!as_offset) ptr2++;

// Check for a range of levels
if ((ptr3 = strchr(ptr2, '-')) != NULL)
{
if ((ptr3 = strchr(ptr2, '-')) != NULL) {

// Check if a range has already been supplied
if (Dimension.has(range_flag))
{
if (Dimension.has(range_flag)) {
mlog << Error << "\n" << method_name
<< "only one dimension can have a range for NetCDF variable \""
<< MagicStr << "\".\n\n";
exit(1);
}
else
{
else {
// Store the dimension of the range and limits
*ptr3++ = 0;
add_dimension(range_flag, as_offset);
Expand All @@ -228,15 +225,13 @@ void VarInfoNcCF::set_magic(const ConcatString &nstr, const ConcatString &lstr)
// Check for a range of times
else if ((ptr3 = strchr(ptr2, ':')) != NULL) {
// Check if a range has already been supplied
if (Dimension.has(range_flag))
{
if (Dimension.has(range_flag)) {
mlog << Error << "\n" << method_name
<< "only one dimension can have a range for NetCDF variable \""
<< MagicStr << "\".\n\n";
exit(1);
}
else
{
else {
int increment = 1;
// Store the dimension of the range and limits
*ptr3++ = 0;
Expand Down Expand Up @@ -282,8 +277,7 @@ void VarInfoNcCF::set_magic(const ConcatString &nstr, const ConcatString &lstr)
Level.set_is_offset(as_offset);
}
}
else
{
else {
// Single level
int level = 0;
double level_value = bad_data_double;
Expand Down
4 changes: 2 additions & 2 deletions src/libcode/vx_data2d_nccf/var_info_nccf.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ class VarInfoNcCF : public VarInfo
// get stuff
//

GrdFileType file_type() const;
GrdFileType file_type() const;
const LongArray & dimension() const;
int dimension(int i) const;
const NumArray & dim_value() const;
Expand All @@ -72,7 +72,7 @@ class VarInfoNcCF : public VarInfo
void set_magic(const ConcatString &, const ConcatString &);
void set_dict(Dictionary &s);

void add_dimension(int dim, bool as_index=true, double dim_value=bad_data_double);
void add_dimension(int dim, bool as_offset=true, double dim_value=bad_data_double);

//
// do stuff
Expand Down

0 comments on commit 9483883

Please sign in to comment.