Skip to content

Commit

Permalink
feat: add RS_Rotation test in spark
Browse files Browse the repository at this point in the history
  • Loading branch information
furqaankhan committed Oct 25, 2023
1 parent 731f75c commit 2f2cc22
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,8 @@
import org.opengis.referencing.operation.TransformException;

import java.io.IOException;
import java.util.Arrays;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertThrows;
import static org.junit.Assert.*;

public class RasterAccessorsTest extends RasterTestBase
{
Expand Down Expand Up @@ -74,7 +72,7 @@ public void testGeoTransform() throws FactoryException {
GridCoverage2D emptyRaster = RasterConstructors.makeEmptyRaster(1, 10, 15, 1, 2, 1, -1, 10, 10, 0);
double[] actual = RasterAccessors.getGeoTransform(emptyRaster);
double[] expected = new double[] {10.04987562112089, 10.04987562112089, -1.4711276743037347, 1.5707963267948966, 0.0, 0.0};
assertEquals(expected, actual);
assertArrayEquals(expected, actual, 1e-9);
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -609,6 +609,13 @@ class rasteralgebraTest extends TestBaseScala with BeforeAndAfter with GivenWhen
assertEquals(expected, result)
}

it("Passed RS_Rotation") {
val df = sparkSession.sql("SELECT RS_MakeEmptyRaster(2, 10, 15, 1, 2, 1, -2, 1, 2, 0) as raster")
val actual = df.selectExpr("RS_Rotation(raster)").first().get(0)
val expected = -1.1071487177940904
assertEquals(expected, actual)
}

it("Passed RS_SkewX") {
val df = sparkSession.read.format("binaryFile").load(resourceFolder + "raster/test1.tiff")
val result = df.selectExpr("RS_SkewX(RS_FromGeoTiff(content))").first().getDouble(0)
Expand Down

0 comments on commit 2f2cc22

Please sign in to comment.