You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
WBAssertThrow(colon_location!= std::string::npos,"when choosing Litho1.0 you need to specify a subunit with the colon (:)." );
735
-
std::string rest_of_string = value.substr(colon_location); // TODO: improve and make more robust, look at gwb-dat example
736
-
while ((!rest_of_string.empty()) && (rest_of_string[0] == ''))
737
-
rest_of_string.erase(rest_of_string.begin());
738
-
while ((!rest_of_string.empty()) && (rest_of_string[0] == ':'))
739
-
rest_of_string.erase(rest_of_string.begin());
740
-
while ((!rest_of_string.empty()) && (rest_of_string[0] == ''))
741
-
rest_of_string.erase(rest_of_string.begin());
742
-
while ((!rest_of_string.empty()) && (rest_of_string[rest_of_string.size() - 1] == ''))
743
-
rest_of_string.erase(rest_of_string.end() - 1);
744
-
LayerType layer_type = LayerType::MAX_LAYERTYPE;
745
-
if (rest_of_string == "lithosphere")
746
-
{
747
-
layer_type = LayerType::LITHOSPHERE;
748
-
}
749
-
elseif (rest_of_string == "crust 3")
750
-
{
751
-
layer_type = LayerType::CRUST3;
752
-
}
753
-
elseif (rest_of_string == "crust 2")
754
-
{
755
-
layer_type = LayerType::CRUST2;
756
-
}
757
-
elseif (rest_of_string == "crust 1")
758
-
{
759
-
layer_type = LayerType::CRUST1;
760
-
}
761
-
elseif (rest_of_string == "sediment 3")
762
-
{
763
-
layer_type = LayerType::SEDIMENT3;
764
-
}
765
-
elseif (rest_of_string == "sediment 2")
766
-
{
767
-
layer_type = LayerType::SEDIMENT2;
768
-
}
769
-
elseif (rest_of_string == "sediment 1")
770
-
{
771
-
layer_type = LayerType::SEDIMENT1;
772
-
}
773
-
elseif (rest_of_string == "ice")
774
-
{
775
-
layer_type = LayerType::ICE;
776
-
}
777
-
elseif (rest_of_string == "water")
778
-
{
779
-
layer_type = LayerType::WATER;
780
-
}
781
-
WBAssertThrow(layer_type != LayerType::MAX_LAYERTYPE, "Could not find litho1.0 layer type " << rest_of_string);
782
-
std::string litho_1_0_path = "";
783
-
Value *value_pointer = Pointer("/Litho1.0 path").Get(parameters);
784
-
WBAssertThrow(value_pointer != nullptr, "You are using the Litho1.0 dataset, but you have not specified the path to the dataset. Please add below \"version\": \"Litho1.0 path\". ");
785
-
try
786
-
{
787
-
litho_1_0_path = value_pointer->GetString();
788
-
}
789
-
catch (...)
790
-
{
791
-
WBAssertThrow(false, "Could not convert values of /Litho1.0 path into a String. ");
WBAssertThrow(colon_location!= std::string::npos,"when choosing Litho1.0 you need to specify a subunit with the colon (:)." );
736
+
std::string rest_of_string = value.substr(colon_location); // TODO: improve and make more robust, look at gwb-dat example
737
+
while ((!rest_of_string.empty()) && (rest_of_string[0] == ' '))
738
+
rest_of_string.erase(rest_of_string.begin());
739
+
while ((!rest_of_string.empty()) && (rest_of_string[0] == ':'))
740
+
rest_of_string.erase(rest_of_string.begin());
741
+
while ((!rest_of_string.empty()) && (rest_of_string[0] == ' '))
742
+
rest_of_string.erase(rest_of_string.begin());
743
+
while ((!rest_of_string.empty()) && (rest_of_string[rest_of_string.size() - 1] == ' '))
744
+
rest_of_string.erase(rest_of_string.end() - 1);
745
+
LayerType layer_type = LayerType::MAX_LAYERTYPE;
746
+
if (rest_of_string == "lithosphere")
747
+
{
748
+
layer_type = LayerType::LITHOSPHERE;
749
+
}
750
+
else if (rest_of_string == "crust 3")
751
+
{
752
+
layer_type = LayerType::CRUST3;
753
+
}
754
+
else if (rest_of_string == "crust 2")
755
+
{
756
+
layer_type = LayerType::CRUST2;
757
+
}
758
+
else if (rest_of_string == "crust 1")
759
+
{
760
+
layer_type = LayerType::CRUST1;
761
+
}
762
+
else if (rest_of_string == "sediment 3")
763
+
{
764
+
layer_type = LayerType::SEDIMENT3;
765
+
}
766
+
else if (rest_of_string == "sediment 2")
767
+
{
768
+
layer_type = LayerType::SEDIMENT2;
769
+
}
770
+
else if (rest_of_string == "sediment 1")
771
+
{
772
+
layer_type = LayerType::SEDIMENT1;
773
+
}
774
+
else if (rest_of_string == "ice")
775
+
{
776
+
layer_type = LayerType::ICE;
777
+
}
778
+
else if (rest_of_string == "water")
779
+
{
780
+
layer_type = LayerType::WATER;
781
+
}
782
+
WBAssertThrow(layer_type != LayerType::MAX_LAYERTYPE, "Could not find litho1.0 layer type " << rest_of_string);
783
+
std::string litho_1_0_path = "";
784
+
Value *value_pointer = Pointer("/Litho1.0 path").Get(parameters);
785
+
WBAssertThrow(value_pointer != nullptr, "You are using the Litho1.0 dataset, but you have not specified the path to the dataset. Please add below \"version\": \"Litho1.0 path\". ");
786
+
try
787
+
{
788
+
litho_1_0_path = value_pointer->GetString();
789
+
}
790
+
catch (...)
791
+
{
792
+
WBAssertThrow(false, "Could not convert values of /Litho1.0 path into a String. ");
0 commit comments