|
|
|
@ -131,7 +131,7 @@ Error COPERNICUSData::Mirror(const CLArgs& args) const
|
|
|
|
|
|
|
|
|
|
std::vector<MString> dsets; |
|
|
|
|
if(args.contains("dataset")) |
|
|
|
|
dsets.push_back(args.at("dataset")); |
|
|
|
|
dsets = args.at("dataset").Split(":,"); |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
|
auto dlist = cat.DatasetList(prod); |
|
|
|
@ -244,43 +244,54 @@ RetVal<Adapter> COPERNICUSData::GetAdapter(const CLArgs& args, michlib_internal:
|
|
|
|
|
|
|
|
|
|
Adapter out(Adapter::ZarrMethod::MZARR); |
|
|
|
|
|
|
|
|
|
MString dataset = args.contains("dataset") ? args.at("dataset") : "DT"; |
|
|
|
|
|
|
|
|
|
GPL.UsePrefix("NEMO"); |
|
|
|
|
|
|
|
|
|
// Get link for dataset
|
|
|
|
|
MString product; |
|
|
|
|
std::vector<MString> dset; |
|
|
|
|
MString dataset; |
|
|
|
|
{ |
|
|
|
|
// Try one url
|
|
|
|
|
MString url = GPL.ParameterSValue(dataset + "_URL", ""); |
|
|
|
|
if(url.Exist()) |
|
|
|
|
if(args.contains("product")) // Get product and dataset from command line
|
|
|
|
|
{ |
|
|
|
|
auto list = url.Split(":"); |
|
|
|
|
product = list[0]; |
|
|
|
|
for(size_t i = 1; i < list.size(); i++) dset.push_back(list[i]); |
|
|
|
|
product = args.at("product"); |
|
|
|
|
if(args.contains("dataset")) dset = args.at("dataset").Split(":,"); |
|
|
|
|
dataset = product + " " + args.at("dataset"); |
|
|
|
|
} |
|
|
|
|
else // Multiple urls
|
|
|
|
|
else // Get product and dataset from command line
|
|
|
|
|
{ |
|
|
|
|
size_t i = 1; |
|
|
|
|
while(true) |
|
|
|
|
// Try one url
|
|
|
|
|
dataset = args.contains("dataset") ? args.at("dataset") : "DT"; |
|
|
|
|
MString url = GPL.ParameterSValue(dataset + "_URL", ""); |
|
|
|
|
if(url.Exist()) |
|
|
|
|
{ |
|
|
|
|
auto list = url.Split(":"); |
|
|
|
|
product = list[0]; |
|
|
|
|
for(size_t i = 1; i < list.size(); i++) dset.push_back(list[i]); |
|
|
|
|
} |
|
|
|
|
else // Multiple urls
|
|
|
|
|
{ |
|
|
|
|
MString url = GPL.ParameterSValue(dataset + "_URL" + i, ""); |
|
|
|
|
if(url.Exist()) |
|
|
|
|
size_t i = 1; |
|
|
|
|
while(true) |
|
|
|
|
{ |
|
|
|
|
// Split url on product and dataset
|
|
|
|
|
auto words = url.Split(":"); |
|
|
|
|
if(words.size() != 2) return {pref, "Invalid url for dataset " + dataset + ": " + url}; |
|
|
|
|
if(product.Exist() && product != words[0]) return {pref, "Product for dataset " + dataset + " was already defined: " + url}; |
|
|
|
|
product = words[0]; |
|
|
|
|
dset.push_back(words[1]); |
|
|
|
|
MString url = GPL.ParameterSValue(dataset + "_URL" + i, ""); |
|
|
|
|
if(url.Exist()) |
|
|
|
|
{ |
|
|
|
|
// Split url on product and dataset
|
|
|
|
|
auto words = url.Split(":"); |
|
|
|
|
if(words.size() != 2) return {pref, "Invalid url for dataset " + dataset + ": " + url}; |
|
|
|
|
if(product.Exist() && product != words[0]) return {pref, "Product for dataset " + dataset + " was already defined: " + url}; |
|
|
|
|
product = words[0]; |
|
|
|
|
dset.push_back(words[1]); |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
break; |
|
|
|
|
i++; |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
break; |
|
|
|
|
i++; |
|
|
|
|
} |
|
|
|
|
if(!product.Exist()) return {pref, "Can't find product for the dataset " + dataset}; |
|
|
|
|
pars.AddParameter("dataset", dataset); |
|
|
|
|
} |
|
|
|
|
if(!product.Exist()) return {pref, "Can't find product for the dataset " + dataset}; |
|
|
|
|
|
|
|
|
|
if(dset.size() == 0) // Get datasets from catalog
|
|
|
|
|
{ |
|
|
|
|
CopernicusCatalog cat; |
|
|
|
@ -299,7 +310,6 @@ RetVal<Adapter> COPERNICUSData::GetAdapter(const CLArgs& args, michlib_internal:
|
|
|
|
|
auto ret = pnc->OpenMultiZarr(product, dset); |
|
|
|
|
if(!ret) return ret.Add(pref, "Can't open dataset " + dataset); |
|
|
|
|
} |
|
|
|
|
pars.AddParameter("dataset", dataset); |
|
|
|
|
|
|
|
|
|
// Title
|
|
|
|
|
{ |
|
|
|
|