Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
aynur committed Dec 8, 2014
2 parents 2fe790c + 7bd565f commit f59bcc9
Show file tree
Hide file tree
Showing 10 changed files with 37 additions and 45 deletions.
6 changes: 6 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@
<module>../beam/beam-cluster-analysis</module>
<module>../beam/beam-collocation</module>
<module>../beam/beam-envisat-reader</module>
<module>../beam/beam-envi-reader</module>
<module>../beam/beam-geotiff</module>
<module>../beam/beam-getasse30-reader</module>
<module>../beam/beam-hdf5-writer</module>
Expand Down Expand Up @@ -253,6 +254,11 @@
<artifactId>beam-envisat-reader</artifactId>
<version>${beam.versionRange}</version>
</dependency>
<dependency>
<groupId>org.esa.beam</groupId>
<artifactId>beam-envi-reader</artifactId>
<version>5.0.1</version>
</dependency>
<dependency>
<groupId>org.esa.beam</groupId>
<artifactId>beam-geotiff</artifactId>
Expand Down
4 changes: 4 additions & 0 deletions seadas-bootstrap/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,10 @@
<groupId>org.esa.beam</groupId>
<artifactId>beam-envisat-reader</artifactId>
</dependency>
<dependency>
<groupId>org.esa.beam</groupId>
<artifactId>beam-envi-reader</artifactId>
</dependency>
<dependency>
<groupId>org.esa.beam</groupId>
<artifactId>beam-geotiff</artifactId>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
package gov.nasa.gsfc.seadas.dataio;

import com.bc.ceres.core.ProgressMonitor;
import org.esa.beam.framework.dataio.ProductIOException;
import org.esa.beam.framework.datamodel.Band;
import org.esa.beam.framework.datamodel.PixelGeoCoding;
import org.esa.beam.framework.datamodel.PixelGeoCoding2;
import org.esa.beam.framework.datamodel.Product;
import org.esa.beam.framework.datamodel.ProductData;

import java.io.IOException;

/**
* Created by IntelliJ IDEA.
* User: seadas
Expand Down Expand Up @@ -97,13 +94,8 @@ public void addGeocoding(final Product product) throws ProductIOException {
latBand = product.getBand(latitude);
lonBand = product.getBand(longitude);
}
try {
if (latBand != null && lonBand != null) {
product.setGeoCoding(new PixelGeoCoding(latBand, lonBand, null, 5, ProgressMonitor.NULL));
}
} catch (IOException e) {
throw new ProductIOException(e.getMessage());
if (latBand != null && lonBand != null) {
product.setGeoCoding(new PixelGeoCoding2(latBand, lonBand, null));
}

}
}
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
package gov.nasa.gsfc.seadas.dataio;

import com.bc.ceres.core.ProgressMonitor;
import org.esa.beam.framework.dataio.ProductIOException;
import org.esa.beam.framework.datamodel.*;
import ucar.ma2.InvalidRangeException;
import ucar.nc2.Attribute;
import ucar.nc2.Variable;

import java.io.IOException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
Expand Down Expand Up @@ -66,12 +63,8 @@ public Product createProduct() throws ProductIOException {
latBand.setData(lats);
ProductData lons = ProductData.createInstance(longitudes);
lonBand.setData(lons);
try {
product.setGeoCoding(new PixelGeoCoding(latBand, lonBand, null, 10, ProgressMonitor.NULL));
} catch (IOException e) {
throw new ProductIOException(e.getMessage());
}

product.setGeoCoding(new PixelGeoCoding2(latBand, lonBand,null));

addFlagsAndMasks(product);

return product;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package gov.nasa.gsfc.seadas.dataio;

import com.bc.ceres.core.ProgressMonitor;
import org.esa.beam.framework.dataio.ProductIOException;
import org.esa.beam.framework.datamodel.*;
import ucar.ma2.Array;
Expand Down Expand Up @@ -333,6 +332,7 @@ public void addGeocoding(final Product product) throws ProductIOException {

Variable latVar = ncFile.findVariable(navGroup + "/" + latitude);
Variable lonVar = ncFile.findVariable(navGroup + "/" + longitude);

if (latVar != null && lonVar != null ) {
final ProductData lonRawData;
final ProductData latRawData;
Expand All @@ -353,11 +353,8 @@ public void addGeocoding(final Product product) throws ProductIOException {
latBand.setData(latRawData);
lonBand.setData(lonRawData);

try {
product.setGeoCoding(new PixelGeoCoding(latBand, lonBand, null, 5, ProgressMonitor.NULL));
} catch (IOException e) {
throw new ProductIOException(e.getMessage());
}
product.setGeoCoding(new PixelGeoCoding2(latBand, lonBand,null));

}
}
}
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
package gov.nasa.gsfc.seadas.dataio;

import com.bc.ceres.core.ProgressMonitor;
import org.esa.beam.framework.dataio.ProductIOException;
import org.esa.beam.framework.datamodel.Band;
import org.esa.beam.framework.datamodel.PixelGeoCoding;
import org.esa.beam.framework.datamodel.PixelGeoCoding2;
import org.esa.beam.framework.datamodel.Product;
import org.esa.beam.framework.datamodel.ProductData;
import ucar.nc2.Variable;

import java.io.IOException;
import java.util.List;

/**
Expand Down Expand Up @@ -97,11 +94,7 @@ public void addGeocoding(final Product product) throws ProductIOException {
latBand.setNoDataValueUsed(true);
lonBand.setNoDataValueUsed(true);

try {
product.setGeoCoding(new PixelGeoCoding(latBand, lonBand, null, 5, ProgressMonitor.NULL));
} catch (IOException e) {
throw new ProductIOException(e.getMessage());
}
product.setGeoCoding(new PixelGeoCoding2(latBand, lonBand,null));
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -314,13 +314,8 @@ public void addPixelGeocoding(final Product product) throws ProductIOException {
}
}
}
try {
if (latBand != null) {
product.setGeoCoding(new PixelGeoCoding(latBand, lonBand, null, 5, ProgressMonitor.NULL));
}
} catch (IOException e) {
throw new ProductIOException(e.getMessage());
if (latBand != null) {
product.setGeoCoding(new PixelGeoCoding2(latBand, lonBand,null));
}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,11 @@ public synchronized void readBandData(Band destBand, int sourceOffsetX, int sou
sourceOffsetX = destBand.getSceneRasterWidth() - (sourceOffsetX + sourceWidth);
}
sourceOffsetY += leadLineSkip;
int widthRemainder = destBand.getSceneRasterWidth() - (sourceOffsetX + sourceWidth);

if (widthRemainder < 0){
sourceWidth += widthRemainder;
}
start[0] = sourceOffsetY;
start[1] = sourceOffsetX;
stride[0] = sourceStepY;
Expand Down Expand Up @@ -100,7 +105,12 @@ public synchronized void readBandData(Band destBand, int sourceOffsetX, int sou
storage = array.copyTo1DJavaArray();
}

arraycopy(storage, 0, buffer, 0, destBuffer.getNumElems());
if (widthRemainder < 0){
arraycopy(storage, 0, buffer, 0, destBuffer.getNumElems() + widthRemainder);
}else{
arraycopy(storage, 0, buffer, 0, destBuffer.getNumElems());

}
} finally {
pm.done();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,10 @@ protected Product readProductNodesImpl() throws IOException {

}

return seadasFileReader.createProduct();
Product product = seadasFileReader.createProduct();

configurePreferredTileSize(product);
return product;

} catch (IOException e) {
throw new ProductIOException(e.getMessage());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,6 @@ else if (shortName.contains("VIIRS-DualGain")){
ProductData lons = ProductData.createInstance(longitudes);
lonBand.setData(lons);

//product.setGeoCoding(new PixelGeoCoding(latBand, lonBand, null, 5, ProgressMonitor.NULL));
product.setGeoCoding(new BowtiePixelGeoCoding(latBand, lonBand, detectorsInScan));
} else {
product.setGeoCoding(new BowtiePixelGeoCoding(product.getBand(latitude), product.getBand(longitude), detectorsInScan));
Expand Down

0 comments on commit f59bcc9

Please sign in to comment.