Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,10 @@ public class Rad2ReflAuxdata {
public static Rad2ReflAuxdata loadMERISAuxdata(String productType) throws IOException {
final Path auxdataDir = installAuxdata();

if (productType.startsWith("MER_F")) {
final ResolutionType resolutionType = getResolutionType(productType);
if (resolutionType == ResolutionType.FULL) {
return loadFRAuxdata(auxdataDir);
} else if (productType.startsWith("MER_R")) {
} else if (resolutionType == ResolutionType.REDUCED) {
return loadRRAuxdata(auxdataDir);
} else {
throw new IOException(String.format("No auxillary data found for input product of type '%s'", productType));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ public void testGetResolutionType() {

assertEquals(ResolutionType.FULL, Rad2ReflAuxdata.getResolutionType("MER_FR__1P"));
assertEquals(ResolutionType.FULL, Rad2ReflAuxdata.getResolutionType("Derived from(MER_FRS_1P)"));
assertEquals(ResolutionType.FULL, Rad2ReflAuxdata.getResolutionType("Derived from (MER_FRS_1P)"));

assertEquals(ResolutionType.UNKNOWN, Rad2ReflAuxdata.getResolutionType("STRANGE-TYPE"));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -534,8 +534,10 @@ public static int getFullPSDversion(VirtualPath path){
psd = 148;
} else if(Integer.parseInt(psdNumber) == 14 && !aux.contains("L2A_Product_Info") && !aux.contains("TILE_ID_2A")) {
psd = 143;
}else{
}else if(Integer.parseInt(psdNumber) >= 15){
psd = Integer.parseInt(psdNumber) * 10;
} else {
psd = Integer.parseInt(psdNumber);
}
} else {
psd = 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ public S2Metadata.MaskFilename[] getMasks(VirtualPath path) {
}
for (String maskFilename : maskFilenames) {
//To be sure that it is not a relative path and finish with .gml
String filenameProcessed = Paths.get(maskFilename).getFileName().toString();
String filenameProcessed = Paths.get(maskFilename.replaceAll("\\\\","/")).getFileName().toString();
if(gmlMaskFormat){
if(!filenameProcessed.endsWith(".gml")) {
filenameProcessed = filenameProcessed + ".gml";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -575,10 +575,7 @@ protected void addFlagsAndMasks(Product product) {
if (metadataElementBand != null) {
MetadataElement metadataElementL2Flags = metadataElementBand.getElement("l2_flags");
if (metadataElementL2Flags != null) {
flagMeanings =metadataElementL2Flags.getAttribute("FLAG_MEANINGS").getData().getElemString();
if (flagMeanings != null) {
flagNames = flagMeanings.split(" ");
}
setFlagMeaningsAndNames(product, metadataElementL2Flags);
}
}
} catch (Exception ignore) {
Expand Down Expand Up @@ -1170,11 +1167,24 @@ protected void addFlagsAndMasks(Product product) {
}
}






private void setFlagMeaningsAndNames(Product product, MetadataElement metadataElementL2Flags) {
final MetadataAttribute flagMeaningsAttribute = metadataElementL2Flags.getAttribute("FLAG_MEANINGS");
if (flagMeaningsAttribute != null) {
flagMeanings = flagMeaningsAttribute.getData().getElemString();
flagNames = flagMeanings.split(" ");
} else {
final MetadataElement global = product.getMetadataRoot().getElement("Global_Attributes");
if (global != null) {
final MetadataAttribute maskNamesAttribute = global.getAttribute("Mask_Names");
if (maskNamesAttribute != null) {
flagMeanings = maskNamesAttribute.getData().getElemString();
if (flagMeanings != null) {
flagNames = flagMeanings.split(",");
}
}
}
}
}


private Mask createMask(Product product, String maskName, Color maskColor, double maskTransparency) {
Expand Down