Skip to content
Merged
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
20 changes: 20 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,26 @@

*

* Doc:

*

## 1.2.0 (2026-05-04)

### Main feature

Include a shift compensation for acquisition with DATATAKE_TYPE at INS-RAW to compensate https://esa-cams.atlassian.net/browse/GSANOM-22074

### Updates

* Fix:

*

* Feature:

* Issue #73: Include a shift compensation for acquisition with DATATAKE_TYPE at INS-RAW to compensate https://esa-cams.atlassian.net/browse/GSANOM-22074

* Doc:

* Point to new CDSE official DEM download
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
FROM ghcr.io/sen2vm/sen2vm-build-env:latest AS launcher

ENV SEN2VM_VERSION=1.1.4
ENV SEN2VM_VERSION=1.2.0

WORKDIR /Sen2vm

Expand Down
3 changes: 2 additions & 1 deletion documentation/Input/input_description.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ Each parameter description can be found in the table below:
| export_alt | boolean | Optional | If set to false (default), direct location grids will include only two bands: **Long/Lat**. If set to true, a third band representing the **Altitude** will also be exported, increasing the output grid size. See product description in §[Direct location grids](../Output/output_direct_loc.md) |
| steps | double | **Mandatory** | The step is mandatory and must be specified as one per resolution: “10m_bands”, “20m_bands” & “60m_bands””. Please note that only floating numbers in the format NNNN.DDD are accepted and that the unit is given in pixel for direct location and in metrics of referential system for inverse location. **For direct location grids, the GRID step value cannot be under 1.** |
| inverse_location_additional_info | | **Mandatory if “inverse”, else useless.**| For the inverse location additional information please refer to the dedicated table below |
| deactivate_ins_raw_shift | boolean | Optional | RAW Products are impacted by an issue creating a shift. To compensate (workaround) those shifts, dedicated GIPP (GIP_PRDLOC) is mandatory for acquisition with DATATAKE_TYPE=INS-RAW. If in future, INS-RAW L1B are corrected, this boolean allows to deactivate the shifts compensation |


The field “inverse_location_additional_info” is not required and will be ignored if direct location grids are asked. However, it is mandatory for inverse location grids generation and **Sen2VM will raise an error** if this information is missing.
Expand All @@ -69,7 +70,7 @@ The field “inverse_location_additional_info” is not required and will be ign
> [!NOTE]
> Inverse location grids footprint will enclose desired product footprint [ul_x, ul_y, lr_x, lr_y].

Those parameters can be sent to Sen2 VM:
Those parameters can be sent to Sen2VM:

* either by setting each argument in a command line see [HOWTO](../Usage/HOWTO.md)
* either using an input configuration file in [JSON format](https://en.wikipedia.org/wiki/JSON). An example of configuration file is available at: https://github.com/sen2vm/sen2vm-core/blob/main/src/test/resources/configuration_example.json :
Expand Down
3 changes: 2 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<groupId>esa.sen2vm</groupId>
<artifactId>sen2vm-core</artifactId>
<!-- NOTE: remind to change also the SEN2VM_VERSION in the Dokerfile-->
<version>1.1.4</version>
<version>1.2.0</version>

<name>sen2vm-core</name>
<url>https://github.com/sen2vm/sen2vm-core</url>
Expand Down Expand Up @@ -148,6 +148,7 @@
<sources>
<source>${basedir}/src/main/resources/xsd/GIPP/GS2_GIPP/gs2_blind_pixels.xsd</source>
<source>${basedir}/src/main/resources/xsd/GIPP/GS2_GIPP/gs2_spacecraft_model_parameters.xsd</source>
<source>${basedir}/src/main/resources/xsd/GIPP/GS2_GIPP/gs2_init_loc_prod_parameters.xsd</source>
<source>${basedir}/src/main/resources/xsd/GIPP/GS2_GIPP/gs2_viewing_directions.xsd</source>
<source>${basedir}/src/main/resources/xsd/Datastrip/S2_PDI_Level-1B_Datastrip_Metadata.xsd</source>
<source>${basedir}/src/main/resources/xsd/Datastrip/S2_PDI_Level-1B_Granule_Metadata.xsd</source>
Expand Down
8 changes: 6 additions & 2 deletions src/main/java/esa/sen2vm/Sen2VM.java
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,11 @@ public static void main( String[] args ) throws Sen2VMException, Exception
LOGGER.info("Bands list: " + bands);

// Read datastrip
DataStripManager dataStripManager = new DataStripManager(config.getDatastripFilePath(), config.getIers(), !config.getDeactivateRefining());
DataStripManager dataStripManager = new DataStripManager(
config.getDatastripFilePath(),
config.getIers(),
!config.getDeactivateRefining(),
config.getIgnoreInsRawShifts());

// Read GIPP
GIPPManager gippManager = new GIPPManager(config.getGippFolder(), bands, dataStripManager, config.getGippVersionCheck());
Expand Down Expand Up @@ -194,7 +198,7 @@ public static void main( String[] args ) throws Sen2VMException, Exception
for (BandInfo bandInfo: bands)
{
SensorViewingDirection viewing = gippManager.getSensorViewingDirections(bandInfo, detectorInfo);
LineDatation lineDatation = dataStripManager.getLineDatation(bandInfo, detectorInfo);
LineDatation lineDatation = dataStripManager.getLineDatation(bandInfo, detectorInfo,gippManager.getRawShifts(bandInfo, detectorInfo));
SpaceCraftModelTransformation pilotingToMsi = gippManager.getPilotingToMsiTransformation();
SpaceCraftModelTransformation msiToFocalplane = gippManager.getMsiToFocalPlaneTransformation(bandInfo);
SpaceCraftModelTransformation focalplaneToSensor = gippManager.getFocalPlaneToDetectorTransformation(bandInfo, detectorInfo);
Expand Down
15 changes: 15 additions & 0 deletions src/main/java/esa/sen2vm/enums/DetectorInfo.java
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,21 @@ public static DetectorInfo getDetectorInfoFromIndex(int detectorIndex)
return DetectorInfo.values()[detectorIndex];
}

/**
* Get DetectorInfo from detector number
* @param detectorNumber detector number (from 1 to 12)
* @return the detector having the given number (from 1 to 12). Null if not found
*/
public static DetectorInfo getDetectorInfoFromNumber(int detectorNumber)
{
int nbDetector = DetectorInfo.values().length;
if (detectorNumber <= 0 || detectorNumber > nbDetector)
{
return null;
}
return DetectorInfo.values()[detectorNumber - 1];
}

/**
* @return the index
*/
Expand Down
30 changes: 29 additions & 1 deletion src/main/java/esa/sen2vm/input/Configuration.java
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,15 @@ public class Configuration extends InputFileManager
private double step_band20m;
private double step_band60m;
private boolean exportAlt = Sen2VMConstants.EXPORT_ALT;
//Only for inverse location
private double ul_x;
private double ul_y;
private double lr_x;
private double lr_y;
private String referential;
private String outputFolder;

//For INS-RAW correction due to https://esa-cams.atlassian.net/browse/GSANOM-22074
private boolean ignoreInsRawShifts = false;

/**
* Constructor
Expand Down Expand Up @@ -152,6 +154,17 @@ public Configuration(CommandLine commandLine) throws Sen2VMException
this.lr_y = Double.parseDouble(commandLine.getOptionValue(OptionManager.OPT_LRY_SHORT));
this.outputFolder = PathUtils.checkPath(commandLine.getOptionValue(OptionManager.OPT_OUTPUT_FOLDER_SHORT));
}

//For INS-RAW correction due to https://esa-cams.atlassian.net/browse/GSANOM-22074
// By default we want to keep the shifts.
if (commandLine.hasOption(OptionManager.OPT_DEACTIVATE_INS_RAW_SHIFT_SHORT))
{
this.ignoreInsRawShifts = true;
}
else
{ // We keep the shifts
this.ignoreInsRawShifts = false;
}
}

/**
Expand Down Expand Up @@ -255,6 +268,12 @@ public void parse(String jsonFilePath) throws Sen2VMException
}
}
}

// Check the type of location: direct or inverse
if (jsonObject.has("deactivate_ins_raw_shift"))
{
this.ignoreInsRawShifts = jsonObject.getBoolean("deactivate_ins_raw_shift");
}
}
catch (JSONException | IOException e)
{
Expand Down Expand Up @@ -442,4 +461,13 @@ public String getInverseLocOutputFolder()
{
return this.outputFolder;
}

/**
* Get boolean if shifts for INS-RAW are defined
* @return boolean if shifts for INS-RAW are defined
*/
public boolean getIgnoreInsRawShifts()
{
return this.ignoreInsRawShifts;
}
}
15 changes: 14 additions & 1 deletion src/main/java/esa/sen2vm/input/OptionManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,13 @@ public class OptionManager
public static final String OPT_OUTPUT_IMAGE_RES_LONG = "output_image_res";
public static final String OPT_OUTPUT_IMAGE_RES_SHORT = "or";

/**
* Option for ins raw shifts (pixels)
* For INS-RAW correction due to https://esa-cams.atlassian.net/browse/GSANOM-22074
*/
public static final String OPT_DEACTIVATE_INS_RAW_SHIFT_LONG = "ignore_ins_raw_shifts_compensation";
public static final String OPT_DEACTIVATE_INS_RAW_SHIFT_SHORT = "is";

/*******************************
* Options for the params
*******************************/
Expand Down Expand Up @@ -308,7 +315,12 @@ public static CommandLine readCommandLineArguments(String[] args) throws Sen2VME
outputImageRes.setType(Double.class); // TODO does not seem to work: read as array of String
outputImageRes.setArgs(3);
outputImageRes.setRequired(true);


Option ignore_raw_shifts = new Option(OPT_DEACTIVATE_INS_RAW_SHIFT_SHORT, OPT_DEACTIVATE_INS_RAW_SHIFT_LONG, false,
"(Optional) Deactivate workaround for INS_RAW DATATAKE_TYPE due to https://esa-cams.atlassian.net/browse/GSANOM-22074\n"
+ "if present= \"true\", if not= \"false\".");
ignore_raw_shifts.setRequired(false);

// params arguments
// ------------------
Option detectors = new Option(OPT_DETECTORS_LIST_SHORT, OPT_DETECTORS_LIST_LONG, true, "(optional) List of detectors to process separated by spaces, example: 01 05 06 10 11");
Expand All @@ -334,6 +346,7 @@ public static CommandLine readCommandLineArguments(String[] args) throws Sen2VME
optionsNoFile.addOption(noAutoGippSelectionOption);
optionsNoFile.addOption(overwrite_grids);
optionsNoFile.addOption(noRefiningOption);
optionsNoFile.addOption(ignore_raw_shifts);
optionsNoFile.addOption(exportAltOption);
optionsNoFile.addOption(ulxOption);
optionsNoFile.addOption(ulyOption);
Expand Down
43 changes: 41 additions & 2 deletions src/main/java/esa/sen2vm/input/datastrip/DataStripManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@
import https.psd_15_sentinel2_eo_esa_int.dico.pdi_v15.sy.misc.A_ROTATION_TRANSLATION_HOMOTHETY_UNCERTAINTIES_TYPE_LOWER_CASE;
import https.psd_15_sentinel2_eo_esa_int.psd.s2_pdi_level_1b_datastrip_metadata.Level1B_DataStrip;


/**
* Manager for Datastrip directory
*/
Expand All @@ -113,6 +114,11 @@ public class DataStripManager
*/
protected Level1B_DataStrip l1B_datastrip = null;

/**
* DATATAKE_TYPE
*/
protected boolean isRaw = false;

/**
* Sensor configuration
*/
Expand Down Expand Up @@ -194,10 +200,12 @@ public class DataStripManager
* @throws Sen2VMException
*/
public DataStripManager(String dsFilePath, String iersFilePath,
Boolean activateAvailableRefining) throws Sen2VMException
Boolean activateAvailableRefining, Boolean deactivateRawShift) throws Sen2VMException
{
this.dsFile = new File(dsFilePath);

gps = TimeScalesFactory.getGPS();
this.isRaw = deactivateRawShift;
loadFile(dsFilePath, iersFilePath, activateAvailableRefining);
}

Expand Down Expand Up @@ -238,6 +246,18 @@ protected void loadFile(String dsFilePath, String iersFilePath,
JAXBElement<Level1B_DataStrip> jaxbElement = (JAXBElement<Level1B_DataStrip>) jaxbUnmarshaller.unmarshal(datastripFile);
l1B_datastrip = jaxbElement.getValue();

Boolean isRawDatastrip = (l1B_datastrip.getGeneral_Info().getDatatake_Info().getDATATAKE_TYPE().value() == "INS-RAW");
if (isRawDatastrip)
{
LOGGER.info("DATATAKE_TYPE is INS-RAW");
}else{
LOGGER.info("DATATAKE_TYPE is NOT INS-RAW");
}
//this.isRaw is containing deactivate raw shifts
if (this.isRaw & isRawDatastrip)
LOGGER.info("Deactivation of INS-RAW shifts");
this.isRaw = (isRawDatastrip && !this.isRaw);

sensorConfiguration = l1B_datastrip.getImage_Data_Info().getSensor_Configuration();

auxiliaryDataInfo = l1B_datastrip.getAuxiliary_Data_Info();
Expand Down Expand Up @@ -382,6 +402,9 @@ public void initOrekitRessources(String orekitDataPath, String iersFilePath,
A_DOUBLE_WITH_ARCSEC_UNIT_ATTR poleVAngle = iersBulletin.getPOLE_V_ANGLE();

XMLGregorianCalendar datastripStartDateGregorian = dataStripTimeInfo.getDATASTRIP_SENSING_START();



AbsoluteDate datastripStartDateUTC = new AbsoluteDate(datastripStartDateGregorian.toString(), TimeScalesFactory.getUTC());
int year = datastripStartDateUTC.getComponents(TimeScalesFactory.getUTC()).getDate().getYear();

Expand Down Expand Up @@ -892,7 +915,7 @@ public void checkGIPPVersion(String gippFilepath, String gippVersion) throws Sen
* @param detectorIndex the detector index
* @return
*/
public LineDatation getLineDatation(BandInfo bandInfo, DetectorInfo detectorInfo)
public LineDatation getLineDatation(BandInfo bandInfo, DetectorInfo detectorInfo, int rawshift) throws Sen2VMException
{
AbsoluteDate referenceDate = null;
double referenceLineDouble = 1d;
Expand Down Expand Up @@ -931,6 +954,14 @@ public LineDatation getLineDatation(BandInfo bandInfo, DetectorInfo detectorInfo
referenceDate = new AbsoluteDate(referenceDateXML.toString(), gps);
// We shift the date of a half line period to be in the middle of the line
referenceDate = referenceDate.shiftedBy(halfLinePeriod / 1000d);

// Apply shift workaround due to https://esa-cams.atlassian.net/browse/GSANOM-22074 for INS-RAW
if(isRaw)
{
LOGGER.info("Applying shift as DATATAKE_TYPE is INS-RAW:" + rawshift + " for " + detectorInfo.getNameWithD() + "-" + bandInfo.getNameWithB());
// referenceDate = referenceDate.shiftedBy( rawshift * (bandInfo.getPixelHeight()/10) * 2 * halfLinePeriod / 1000d);
referenceDate = referenceDate.shiftedBy( rawshift * 2 * halfLinePeriod / 1000d);
}
}
else
{
Expand Down Expand Up @@ -1016,4 +1047,12 @@ public RefiningInfo getRefiningInfo()
{
return refiningInfo;
}

/**
* @return isRaw
*/
public boolean getIsRaw()
{
return isRaw;
}
}
33 changes: 32 additions & 1 deletion src/main/java/esa/sen2vm/input/gipp/GIPPFileManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,12 @@ public class GIPPFileManager
*/
protected File spaModFile = null;

protected boolean isRaw;
/**
* GIPP spa mod XML files
*/
protected File prdlocFile = null;

/**
* Default constructor
*/
Expand Down Expand Up @@ -338,8 +344,9 @@ private static String getFilePathWithoutExtension(File file)
* @param folder contains the GIPP xml files
* @throws Sen2VMException
*/
public GIPPFileManager(String folder, List<String> gippList) throws Sen2VMException
public GIPPFileManager(String folder, List<String> gippList, boolean isRaw) throws Sen2VMException
{
this.isRaw = isRaw;
LOGGER.info("Get through GIPP folder: "+ folder);
List<String> validExtensions = Arrays.asList(Sen2VMConstants.xml_extention_small,
Sen2VMConstants.xml_extention_big,
Expand All @@ -350,9 +357,11 @@ public GIPPFileManager(String folder, List<String> gippList) throws Sen2VMExcept
String blindPixelGIPType = "GIP_BLINDP";
String spamodGIPType = "GIP_SPAMOD";
String viewingDirGIPType = "GIP_VIEDIR";
String prdlocGIPType = "GIP_PRDLOC";
List<String> blindPixelGIPList = new ArrayList();
List<String> spamodGIPList = new ArrayList();
List<String> viewingDirGIPList = new ArrayList();
List<String> prdlocGIPList = new ArrayList();
if(!gippList.isEmpty())
{
// get blind pixel file
Expand All @@ -363,6 +372,9 @@ public GIPPFileManager(String folder, List<String> gippList) throws Sen2VMExcept

// get viewing direction file
viewingDirGIPList =typedGIPPList(gippList, viewingDirGIPType);

// get prdloc file (only for INS-RAW type)
if (this.isRaw) prdlocGIPList =typedGIPPList(gippList, prdlocGIPType);
}
try
{
Expand All @@ -374,6 +386,9 @@ public GIPPFileManager(String folder, List<String> gippList) throws Sen2VMExcept

// get viewing direction file
viewingDirectionFileList = findGippFiles(gippFolder, viewingDirGIPType, viewingDirGIPList, Sen2VMConstants.GIPP_VIEWDIR_PAT, validExtensions);

// get prdloc file (for INS-RAW only)
if (this.isRaw) prdlocFile = findGippFile(gippFolder, prdlocGIPType, prdlocGIPList, Sen2VMConstants.GIPP_PRDLOC_PAT, validExtensions);
}
catch(IOException e)
{
Expand Down Expand Up @@ -435,4 +450,20 @@ public void setSpaModFile(File spaModFile)
{
this.spaModFile = spaModFile;
}

/**
* @return the prdlocFile
*/
public File getPrdlocFile()
{
return prdlocFile;
}

/**
* @param blindPixelFile the prdlocFile to set
*/
public void setgetPrdlocFile(File prdlocFile)
{
this.prdlocFile = prdlocFile;
}
}
Loading
Loading