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
value = Pointer((strict_base + "/" + name).c_str()).Get(parameters)->GetString();
712
-
}
713
-
catch (...)
714
-
{
715
-
WBAssertThrow(false, "Could not convert values of " << strict_base << "/" << name << " into a String. "
716
-
<< "The provided value was \"" << Pointer((strict_base + "/" + name).c_str()).Get(parameters)->GetString() << "\".");
717
-
}
718
-
if (value.substr(0,8) == "Litho1.0")
719
-
{
720
-
/ *
721
-
enum LayerType
722
-
{
723
-
// ASTHENOSPHERE,
724
-
LITHOSPHERE,
725
-
CRUST3,
726
-
CRUST2,
727
-
CRUST1,
728
-
SEDIMENT3,
729
-
SEDIMENT2,
730
-
SEDIMENT1,
731
-
ICE,
732
-
WATER,
733
-
MAX_LAYERTYPE
734
-
};
735
-
size_t colon_location = value.find(':');
736
-
WBAssertThrow(colon_location!= std::string::npos,"when choosing Litho1.0 you need to specify a subunit with the colon (:)." );
737
-
std::string rest_of_string = value.substr(colon_location); // TODO: improve and make more robust, look at gwb-dat example
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[0] == ' '))
743
-
rest_of_string.erase(rest_of_string.begin());
744
-
while ((!rest_of_string.empty()) && (rest_of_string[rest_of_string.size() - 1] == ' '))
745
-
rest_of_string.erase(rest_of_string.end() - 1);
746
-
LayerType layer_type = LayerType::MAX_LAYERTYPE;
747
-
if (rest_of_string == "lithosphere")
748
-
{
749
-
layer_type = LayerType::LITHOSPHERE;
750
-
}
751
-
else if (rest_of_string == "crust 3")
752
-
{
753
-
layer_type = LayerType::CRUST3;
754
-
}
755
-
else if (rest_of_string == "crust 2")
756
-
{
757
-
layer_type = LayerType::CRUST2;
758
-
}
759
-
else if (rest_of_string == "crust 1")
760
-
{
761
-
layer_type = LayerType::CRUST1;
762
-
}
763
-
else if (rest_of_string == "sediment 3")
764
-
{
765
-
layer_type = LayerType::SEDIMENT3;
766
-
}
767
-
else if (rest_of_string == "sediment 2")
768
-
{
769
-
layer_type = LayerType::SEDIMENT2;
770
-
}
771
-
else if (rest_of_string == "sediment 1")
772
-
{
773
-
layer_type = LayerType::SEDIMENT1;
774
-
}
775
-
else if (rest_of_string == "ice")
776
-
{
777
-
layer_type = LayerType::ICE;
778
-
}
779
-
else if (rest_of_string == "water")
780
-
{
781
-
layer_type = LayerType::WATER;
782
-
}
783
-
WBAssertThrow(layer_type != LayerType::MAX_LAYERTYPE, "Could not find litho1.0 layer type " << rest_of_string);
784
-
std::string litho_1_0_path = "";
785
-
Value *value_pointer = Pointer("/Litho1.0 path").Get(parameters);
786
-
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\". ");
787
-
try
788
-
{
789
-
litho_1_0_path = value_pointer->GetString();
790
-
}
791
-
catch (...)
792
-
{
793
-
WBAssertThrow(false, "Could not convert values of /Litho1.0 path into a String. ");
794
-
}
703
+
//else if (input_type == InputTypes::STRING_TYPE)
704
+
//{
705
+
/*
706
+
// case 5: a string. Get the string and decode it
707
+
std::string value = "";
708
+
709
+
try
710
+
{
711
+
value = Pointer((strict_base + "/" + name).c_str()).Get(parameters)->GetString();
712
+
}
713
+
catch (...)
714
+
{
715
+
WBAssertThrow(false, "Could not convert values of " << strict_base << "/" << name << " into a String. "
716
+
<< "The provided value was \"" << Pointer((strict_base + "/" + name).c_str()).Get(parameters)->GetString() << "\".");
717
+
}
718
+
if (value.substr(0,8) == "Litho1.0")
719
+
{
720
+
/ *
721
+
enum LayerType
722
+
{
723
+
// ASTHENOSPHERE,
724
+
LITHOSPHERE,
725
+
CRUST3,
726
+
CRUST2,
727
+
CRUST1,
728
+
SEDIMENT3,
729
+
SEDIMENT2,
730
+
SEDIMENT1,
731
+
ICE,
732
+
WATER,
733
+
MAX_LAYERTYPE
734
+
};
735
+
size_t colon_location = value.find(':');
736
+
WBAssertThrow(colon_location!= std::string::npos,"when choosing Litho1.0 you need to specify a subunit with the colon (:)." );
737
+
std::string rest_of_string = value.substr(colon_location); // TODO: improve and make more robust, look at gwb-dat example
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[0] == ' '))
743
+
rest_of_string.erase(rest_of_string.begin());
744
+
while ((!rest_of_string.empty()) && (rest_of_string[rest_of_string.size() - 1] == ' '))
745
+
rest_of_string.erase(rest_of_string.end() - 1);
746
+
LayerType layer_type = LayerType::MAX_LAYERTYPE;
747
+
if (rest_of_string == "lithosphere")
748
+
{
749
+
layer_type = LayerType::LITHOSPHERE;
750
+
}
751
+
else if (rest_of_string == "crust 3")
752
+
{
753
+
layer_type = LayerType::CRUST3;
754
+
}
755
+
else if (rest_of_string == "crust 2")
756
+
{
757
+
layer_type = LayerType::CRUST2;
758
+
}
759
+
else if (rest_of_string == "crust 1")
760
+
{
761
+
layer_type = LayerType::CRUST1;
762
+
}
763
+
else if (rest_of_string == "sediment 3")
764
+
{
765
+
layer_type = LayerType::SEDIMENT3;
766
+
}
767
+
else if (rest_of_string == "sediment 2")
768
+
{
769
+
layer_type = LayerType::SEDIMENT2;
770
+
}
771
+
else if (rest_of_string == "sediment 1")
772
+
{
773
+
layer_type = LayerType::SEDIMENT1;
774
+
}
775
+
else if (rest_of_string == "ice")
776
+
{
777
+
layer_type = LayerType::ICE;
778
+
}
779
+
else if (rest_of_string == "water")
780
+
{
781
+
layer_type = LayerType::WATER;
782
+
}
783
+
WBAssertThrow(layer_type != LayerType::MAX_LAYERTYPE, "Could not find litho1.0 layer type " << rest_of_string);
784
+
std::string litho_1_0_path = "";
785
+
Value *value_pointer = Pointer("/Litho1.0 path").Get(parameters);
786
+
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\". ");
787
+
try
788
+
{
789
+
litho_1_0_path = value_pointer->GetString();
790
+
}
791
+
catch (...)
792
+
{
793
+
WBAssertThrow(false, "Could not convert values of /Litho1.0 path into a String. ");
0 commit comments