Skip to content

Commit

Permalink
fixed issue with landsat cli (#1857)
Browse files Browse the repository at this point in the history
  • Loading branch information
rfecher authored Sep 26, 2021
1 parent f15f56a commit 1184215
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 30 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ We can now see what Landsat 8 data is available for our area of interest.

[source, bash]
----
$ geowave util landsat analyze --nbestperspatial --nbestscenes 1 --usecachedscenes --cql "BBOX(shape,13.0535,52.3303,13.7262,52.6675) AND band='B8' AND cloudCover>0" -ws ./landsat
$ geowave util landsat analyze --nbestperspatial true --nbestscenes 1 --usecachedscenes true --cql "BBOX(shape,13.0535,52.3303,13.7262,52.6675) AND band='B8' AND cloudCover>0" -ws ./landsat
----

This command tells GeoWave to analyze the B8 band of Landsat raster data over a bounding box that roughly surrounds Berlin, Germany. It prints out aggregate statistics for the area of interest, including the average cloud cover, date range, number of scenes, and the size of the data. Data for this operation is written to the `landsat` directory (specified by the `-ws` option), which can be used by the ingest step.
Expand All @@ -84,7 +84,7 @@ Now that we have analyzed the available data, we are ready to ingest it into our

[source, bash]
----
$ geowave util landsat ingest --nbestperspatial --nbestscenes 1 --usecachedscenes --cql "BBOX(shape,13.0535,52.3303,13.7262,52.6675) AND band='B8' AND cloudCover>0" --crop --retainimages -ws ./landsat --vectorstore landsatvector --pyramid --coverage berlin_mosaic landsatraster spatial-idx
$ geowave util landsat ingest --nbestperspatial true --nbestscenes 1 --usecachedscenes true --cql "BBOX(shape,13.0535,52.3303,13.7262,52.6675) AND band='B8' AND cloudCover>0" --crop true --retainimages true -ws ./landsat --vectorstore landsatvector --pyramid true --coverage berlin_mosaic landsatraster spatial-idx
----

There is a lot to this command, but you'll see that it's quite similar to the analyze command, but with some additional options. The `--crop` option causes the raster data to be cropped to our CQL bounding box. The `--vectorstore landsatvector` option specifies the data store to put the vector data (scene and band information). The `--pyramid` option tells GeoWave to create an image pyramid for the raster, this is used for more efficient rendering at different zoom levels. The `--coverage berlin_mosaic` option tells GeoWave to use `berlin_mosaic` as the type name for the raster data. Finally, we specify the output data store for the raster, and the index to store it on.
Expand Down
4 changes: 2 additions & 2 deletions docs/content/quickstart/015-raster-demo.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ We can now see what Landsat 8 data is available for our area of interest.

[source, bash]
----
$ geowave util landsat analyze --nbestperspatial --nbestscenes 1 --usecachedscenes --cql "BBOX(shape,13.0535,52.3303,13.7262,52.6675) AND band='B8' AND cloudCover>0" -ws ./landsat
$ geowave util landsat analyze --nbestperspatial true --nbestscenes 1 --usecachedscenes true --cql "BBOX(shape,13.0535,52.3303,13.7262,52.6675) AND band='B8' AND cloudCover>0" -ws ./landsat
----

This command tells GeoWave to analyze the B8 band of Landsat raster data over a bounding box that roughly surrounds Berlin, Germany. It prints out aggregate statistics for the area of interest, including the average cloud cover, date range, number of scenes, and the size of the data. Data for this operation is written to the `landsat` directory (specified by the `-ws` option), which can be used by the ingest step.
Expand All @@ -63,7 +63,7 @@ Now that we have analyzed the available data, we are ready to ingest it into our

[source, bash]
----
$ geowave util landsat ingest --nbestperspatial --nbestscenes 1 --usecachedscenes --cql "BBOX(shape,13.0535,52.3303,13.7262,52.6675) AND band='B8' AND cloudCover>0" --crop --retainimages -ws ./landsat --vectorstore landsatvector --pyramid --coverage berlin_mosaic landsatraster spatial-idx
$ geowave util landsat ingest --nbestperspatial true --nbestscenes 1 --usecachedscenes true --cql "BBOX(shape,13.0535,52.3303,13.7262,52.6675) AND band='B8' AND cloudCover>0" --crop true --retainimages true -ws ./landsat --vectorstore landsatvector --pyramid true --coverage berlin_mosaic landsatraster spatial-idx
----

There is a lot to this command, but you'll see that it's quite similar to the analyze command, but with some additional options. The `--crop` option causes the raster data to be cropped to our CQL bounding box. The `--vectorstore landsatvector` option specifies the data store to put the vector data (scene and band information). The `--pyramid` option tells GeoWave to create an image pyramid for the raster, this is used for more efficient rendering at different zoom levels. The `--coverage berlin_mosaic` option tells GeoWave to use `berlin_mosaic` as the type name for the raster data. Finally, we specify the output data store for the raster, and the index to store it on.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,13 @@ public class Landsat8BasicCommandLineOptions {

@Parameter(
names = "--sincelastrun",
arity = 1,
description = "An option to check the scenes list from the workspace and if it exists, to only ingest data since the last scene.")
private boolean onlyScenesSinceLastRun;

@Parameter(
names = "--usecachedscenes",
arity = 1,
description = "An option to run against the existing scenes catalog in the workspace directory if it exists.")
private boolean useCachedScenes;

Expand All @@ -55,6 +57,7 @@ public class Landsat8BasicCommandLineOptions {

@Parameter(
names = "--nbestperspatial",
arity = 1,
description = "A boolean flag, when applied with --nbestscenes or --nbestbands will aggregate scenes and/or bands by path/row")
private boolean nBestPerSpatial;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,17 @@
public class Landsat8DownloadCommandLineOptions {
@Parameter(
names = "--overwrite",
arity = 1,
description = "An option to overwrite images that are ingested in the local workspace directory. By default it will keep an existing image rather than downloading it again.")
private boolean overwriteIfExists;
protected boolean overwrite;

public Landsat8DownloadCommandLineOptions() {}

public boolean isOverwriteIfExists() {
return overwriteIfExists;
return overwrite;
}

public void setOverwriteIfExists(final boolean overwriteIfExists) {
this.overwriteIfExists = overwriteIfExists;
public void setOverwriteIfExists(final boolean overwrite) {
this.overwrite = overwrite;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,24 +15,27 @@
public class Landsat8RasterIngestCommandLineOptions {
@Parameter(
names = "--histogram",
arity = 1,
description = "An option to store the histogram of the values of the coverage so that histogram equalization will be performed")
private boolean createHistogram = false;
protected boolean histogram = false;

@Parameter(
names = "--pyramid",
arity = 1,
description = "An option to store an image pyramid for the coverage")
private boolean createPyramid = false;
protected boolean pyramid = false;

@Parameter(
names = "--retainimages",
arity = 1,
description = "An option to keep the images that are ingested in the local workspace directory. By default it will delete the local file after it is ingested successfully.")
private boolean retainImages = false;
protected boolean retainimages = false;

@Parameter(
names = "--tilesize",
description = "The option to set the pixel size for each tile stored in GeoWave. The default is "
+ RasterDataAdapter.DEFAULT_TILE_SIZE)
private int tileSize = RasterDataAdapter.DEFAULT_TILE_SIZE;
protected int tilesize = RasterDataAdapter.DEFAULT_TILE_SIZE;

@Parameter(
names = "--coverage",
Expand All @@ -41,7 +44,7 @@ public class Landsat8RasterIngestCommandLineOptions {
+ "}_${"
+ BandFeatureIterator.BAND_ATTRIBUTE_NAME
+ "}'. If ${band} is unused in the coverage name, all bands will be merged together into the same coverage.")
private String coverageName =
protected String coverage =
"${"
+ SceneFeatureIterator.ENTITY_ID_ATTRIBUTE_NAME
+ "}_${"
Expand All @@ -51,40 +54,42 @@ public class Landsat8RasterIngestCommandLineOptions {
@Parameter(
names = "--converter",
description = "Prior to ingesting an image, this converter will be used to massage the data. The default is not to convert the data.")
private String coverageConverter;
protected String coverageConverter;

@Parameter(
names = "--subsample",
description = "Subsample the image prior to ingest by the scale factor provided. The scale factor should be an integer value greater than 1.",
converter = IntegerConverter.class)
private int scale = 1;
protected int scale = 1;

@Parameter(
names = "--crop",
arity = 1,
description = "Use the spatial constraint provided in CQL to crop the image. If no spatial constraint is provided, this will not have an effect.")
private boolean cropToSpatialConstraint;
protected boolean cropToSpatialConstraint;

@Parameter(
names = "--skipMerge",
arity = 1,
description = "By default the ingest will automerge overlapping tiles as a post-processing optimization step for efficient retrieval, but this will skip the merge process")
private boolean skipMerge;
protected boolean skipMerge;

public Landsat8RasterIngestCommandLineOptions() {}

public boolean isCreateHistogram() {
return createHistogram;
return histogram;
}

public boolean isCreatePyramid() {
return createPyramid;
return pyramid;
}

public boolean isRetainImages() {
return retainImages;
return retainimages;
}

public String getCoverageName() {
return coverageName;
return coverage;
}

public String getCoverageConverter() {
Expand All @@ -95,13 +100,13 @@ public boolean isCoveragePerBand() {
// technically the coverage will be per band if it contains any of the
// band attribute names, but realistically the band name should be the
// only one used
return coverageName.contains("${" + BandFeatureIterator.BAND_ATTRIBUTE_NAME + "}")
|| coverageName.contains("${" + BandFeatureIterator.BAND_DOWNLOAD_ATTRIBUTE_NAME + "}")
|| coverageName.contains("${" + BandFeatureIterator.SIZE_ATTRIBUTE_NAME + "}");
return coverage.contains("${" + BandFeatureIterator.BAND_ATTRIBUTE_NAME + "}")
|| coverage.contains("${" + BandFeatureIterator.BAND_DOWNLOAD_ATTRIBUTE_NAME + "}")
|| coverage.contains("${" + BandFeatureIterator.SIZE_ATTRIBUTE_NAME + "}");
}

public int getTileSize() {
return tileSize;
return tilesize;
}

public boolean isSubsample() {
Expand All @@ -117,23 +122,23 @@ public boolean isCropToSpatialConstraint() {
}

public void setCreateHistogram(final boolean createHistogram) {
this.createHistogram = createHistogram;
this.histogram = createHistogram;
}

public void setCreatePyramid(final boolean createPyramid) {
this.createPyramid = createPyramid;
this.pyramid = createPyramid;
}

public void setRetainImages(final boolean retainImages) {
this.retainImages = retainImages;
this.retainimages = retainImages;
}

public void setTileSize(final int tileSize) {
this.tileSize = tileSize;
this.tilesize = tileSize;
}

public void setCoverageName(final String coverageName) {
this.coverageName = coverageName;
this.coverage = coverageName;
}

public void setCoverageConverter(final String coverageConverter) {
Expand Down

0 comments on commit 1184215

Please sign in to comment.