Skip to content

Commit

Permalink
Fixed evaluation of tile width / tile height settings.
Browse files Browse the repository at this point in the history
  • Loading branch information
forman committed Feb 16, 2011
1 parent bfcb539 commit 885dbbb
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,17 @@
*/
public class EnvisatProductReader extends AbstractProductReader {

/** @since BEAM 4.9 */
/**
* @since BEAM 4.9
*/
private static final String SYSPROP_ENVISAT_USE_PIXEL_GEO_CODING = "beam.envisat.usePixelGeoCoding";
/** @since BEAM 4.9 */
/**
* @since BEAM 4.9
*/
private static final String SYSPROP_ENVISAT_TILE_WIDTH = "beam.envisat.tileWidth";
/** @since BEAM 4.9 */
/**
* @since BEAM 4.9
*/
private static final String SYSPROP_ENVISAT_TILE_HEIGHT = "beam.envisat.tileHeight";

@Deprecated
Expand Down Expand Up @@ -501,17 +507,25 @@ private void addDatasetAnnotationsToProduct(Product product) throws IOException
}

private void setPreferredTileSize(Product product) {
Integer tileWidth = Integer.getInteger(SYSPROP_ENVISAT_TILE_WIDTH);
Integer tileHeight = Integer.getInteger(SYSPROP_ENVISAT_TILE_HEIGHT);
Integer tileWidth = null;
String tileWidthStr = System.getProperty(SYSPROP_ENVISAT_TILE_WIDTH);
if (tileWidthStr != null) {
tileWidth = "*".equals(tileWidthStr) ? sceneRasterWidth : Integer.getInteger(SYSPROP_ENVISAT_TILE_WIDTH);
}
Integer tileHeight = null;
String tileHeightStr = System.getProperty(SYSPROP_ENVISAT_TILE_HEIGHT);
if (tileHeightStr != null) {
tileHeight = "*".equals(tileWidthStr) ? sceneRasterHeight : Integer.getInteger(SYSPROP_ENVISAT_TILE_HEIGHT);
}
if (tileWidth != null || tileHeight != null) {
Dimension tileSize = product.getPreferredTileSize();
Logger logger = BeamLogManager.getSystemLogger();
logger.info(MessageFormat.format("Adjusting tile size for Envisat product {0}", product.getName()));
if (tileSize != null) {
logger.warning(MessageFormat.format("Overwriting tile size {0} x {1}", tileSize.width, tileSize.height));
}
tileWidth = tileWidth != null ? tileWidth : sceneRasterWidth;
tileHeight = tileHeight != null ? tileHeight : sceneRasterHeight;
tileWidth = tileWidth != null ? tileWidth : (tileSize != null ? tileSize.width : tileHeight);
tileHeight = tileHeight != null ? tileHeight : (tileSize != null ? tileSize.height : tileWidth);
product.setPreferredTileSize(tileWidth, tileHeight);
logger.info(MessageFormat.format("Tile size set to {0} x {1}", tileWidth, tileHeight));
}
Expand Down
1 change: 1 addition & 0 deletions src/main/config/beam.config
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ beam.splash.taskLabel.pos = 122,115
# 1. If only tileHeight is provided, tileWidth will equal number of swath pixels.
# 2. If only tileWidth is provided, tileHeight will be number of scan lines.
# 3. If neither tileWidth nor tileHeight is provided, a suitable tile size will be computed.
# The special value '*' means, that full scene width (height) will be used.
# beam.envisat.tileWidth = *
# beam.envisat.tileHeight = 64

Expand Down

0 comments on commit 885dbbb

Please sign in to comment.