Skip to content

Commit e799a03

Browse files
committed
Merge remote-tracking branch 'locationtech/develop' into feature/xz2
Signed-off-by: Jason T. Brown <[email protected]>
2 parents 7497b6e + 9e5b19c commit e799a03

File tree

26 files changed

+99
-69
lines changed

26 files changed

+99
-69
lines changed

build/circleci/Dockerfile

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
FROM circleci/openjdk:8-jdk
22

3-
ENV OPENJPEG_VERSION 2.3.0
3+
ENV OPENJPEG_VERSION 2.3.1
44
ENV GDAL_VERSION 2.4.1
55
ENV JAVA_HOME /usr/lib/jvm/java-8-openjdk-amd64/
66

@@ -11,26 +11,37 @@ RUN sudo apt-get update && \
1111
python python-minimal python2.7 python2.7-minimal \
1212
libpython-stdlib libpython2.7 libpython2.7-minimal libpython2.7-stdlib \
1313
&& sudo apt-get install -y \
14-
python3 \
15-
python3-pip \
1614
pandoc \
1715
wget \
1816
gcc g++ build-essential \
17+
libreadline-gplv2-dev libncursesw5-dev libssl-dev libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-dev \
1918
libcurl4-gnutls-dev \
2019
libproj-dev \
2120
libgeos-dev \
2221
libhdf4-alt-dev \
23-
libhdf5-serial-dev \
2422
bash-completion \
2523
cmake \
2624
imagemagick \
2725
libpng-dev \
28-
swig \
29-
ant \
26+
libffi-dev \
3027
&& sudo apt autoremove \
31-
&& sudo apt-get clean all \
32-
&& pip3 install setuptools ipython==6.2.1 \
33-
&& sudo update-alternatives --install /usr/bin/python python /usr/bin/python3 1
28+
&& sudo apt-get clean all
29+
# && sudo update-alternatives --install /usr/bin/python python /usr/bin/python3 1
30+
# todo s
31+
32+
RUN cd /tmp && \
33+
wget https://www.python.org/ftp/python/3.7.4/Python-3.7.4.tgz && \
34+
tar xzf Python-3.7.4.tgz && \
35+
cd Python-3.7.4 && \
36+
./configure --with-ensurepip=install --prefix=/usr/local --enable-optimization && \
37+
make && \
38+
sudo make altinstall && \
39+
rm -rf Python-3.7.4*
40+
41+
RUN sudo ln -s /usr/local/bin/python3.7 /usr/local/bin/python && \
42+
sudo curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py && \
43+
sudo python get-pip.py && \
44+
sudo pip3 install setuptools ipython==6.2.1
3445

3546
# install OpenJPEG
3647
RUN cd /tmp && \
@@ -52,11 +63,9 @@ RUN cd /tmp && \
5263
./configure \
5364
--with-curl \
5465
--with-hdf4 \
55-
--with-hdf5 \
5666
--with-geos \
5767
--with-geotiff=internal \
5868
--with-hide-internal-symbols \
59-
--with-java=$JAVA_HOME \
6069
--with-libtiff=internal \
6170
--with-libz=internal \
6271
--with-mrf \
@@ -68,7 +77,5 @@ RUN cd /tmp && \
6877
&& \
6978
make -j 8 && \
7079
sudo make install && \
71-
cd swig/java && \
72-
sudo make install && \
7380
sudo ldconfig && \
7481
cd /tmp && sudo rm -Rf gdal*

build/circleci/Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
all:
2+
docker build -t "s22s/rasterframes-circleci:latest" .

build/circleci/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# CircleCI Dockerfile Build file
22

33
```bash
4-
docker build -t s22s/rasterframes-circleci:latest .
4+
make
55
docker push s22s/rasterframes-circleci:latest
66
```

core/src/main/scala/org/apache/spark/sql/rf/TileUDT.scala

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ import org.apache.spark.sql.types.{DataType, _}
2626
import org.locationtech.rasterframes.encoders.CatalystSerializer
2727
import org.locationtech.rasterframes.encoders.CatalystSerializer._
2828
import org.locationtech.rasterframes.model.{Cells, TileDataContext}
29+
import org.locationtech.rasterframes.ref.RasterRef.RasterRefTile
2930
import org.locationtech.rasterframes.tiles.InternalRowTile
3031

3132

@@ -75,12 +76,15 @@ case object TileUDT {
7576
implicit def tileSerializer: CatalystSerializer[Tile] = new CatalystSerializer[Tile] {
7677

7778
override val schema: StructType = StructType(Seq(
78-
StructField("cell_context", schemaOf[TileDataContext], false),
79+
StructField("cell_context", schemaOf[TileDataContext], true),
7980
StructField("cell_data", schemaOf[Cells], false)
8081
))
8182

8283
override def to[R](t: Tile, io: CatalystIO[R]): R = io.create(
83-
io.to(TileDataContext(t)),
84+
t match {
85+
case _: RasterRefTile => null
86+
case o => io.to(TileDataContext(o))
87+
},
8488
io.to(Cells(t))
8589
)
8690

core/src/main/scala/org/locationtech/rasterframes/ref/DelegatingRasterSource.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ abstract class DelegatingRasterSource(source: URI, delegateBuilder: () => GTRast
4343
f(_delRef)
4444
}
4545
catch {
46-
// On this exeception we attempt to recreate the delegate and read again.
46+
// On this Exeception we attempt to recreate the delegate and read again.
4747
case _: java.nio.BufferUnderflowException =>
4848
_delRef = null
4949
val newDel = delegateBuilder()
@@ -62,7 +62,7 @@ abstract class DelegatingRasterSource(source: URI, delegateBuilder: () => GTRast
6262
override def hashCode(): Int = source.hashCode()
6363

6464
// This helps reduce header reads between serializations
65-
def info: SimpleRasterInfo = SimpleRasterInfo.cache.get(source.toASCIIString, _ =>
65+
def info: SimpleRasterInfo = SimpleRasterInfo(source.toASCIIString, _ =>
6666
retryableRead(rs => SimpleRasterInfo(rs))
6767
)
6868

core/src/main/scala/org/locationtech/rasterframes/ref/GDALRasterSource.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ case class GDALRasterSource(source: URI) extends RasterSource with URIRasterSour
4848
VLMRasterSource(tweaked)
4949
}
5050

51-
protected def tiffInfo = SimpleRasterInfo.cache.get(source.toASCIIString, _ => SimpleRasterInfo(gdal))
51+
protected def tiffInfo = SimpleRasterInfo(source.toASCIIString, _ => SimpleRasterInfo(gdal))
5252

5353
override def crs: CRS = tiffInfo.crs
5454

core/src/main/scala/org/locationtech/rasterframes/ref/RasterRef.scala

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ case class RasterRef(source: RasterSource, bandIndex: Int, subextent: Option[Ext
4646
def cols: Int = grid.width
4747
def rows: Int = grid.height
4848
def cellType: CellType = source.cellType
49-
def tile: ProjectedRasterTile = ProjectedRasterTile(RasterRefTile(this), extent, crs)
49+
def tile: ProjectedRasterTile = RasterRefTile(this)
5050

5151
protected lazy val grid: GridBounds =
5252
subgrid.getOrElse(source.rasterExtent.gridBoundsFor(extent, true))
@@ -61,12 +61,12 @@ object RasterRef extends LazyLogging {
6161
private val log = logger
6262

6363
case class RasterRefTile(rr: RasterRef) extends ProjectedRasterTile {
64-
val extent: Extent = rr.extent
65-
val crs: CRS = rr.crs
64+
def extent: Extent = rr.extent
65+
def crs: CRS = rr.crs
6666
override def cellType = rr.cellType
6767

68-
override val cols: Int = rr.cols
69-
override val rows: Int = rr.rows
68+
override def cols: Int = rr.cols
69+
override def rows: Int = rr.rows
7070

7171
protected def delegate: Tile = rr.realizedTile
7272
// NB: This saves us from stack overflow exception

core/src/main/scala/org/locationtech/rasterframes/ref/RasterSource.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ object RasterSource extends LazyLogging {
9292

9393
val cacheTimeout: Duration = Duration.fromNanos(rfConfig.getDuration("raster-source-cache-timeout").toNanos)
9494

95-
private val rsCache = Scaffeine()
95+
private[ref] val rsCache = Scaffeine()
9696
.recordStats()
9797
.expireAfterAccess(RasterSource.cacheTimeout)
9898
.build[String, RasterSource]

core/src/main/scala/org/locationtech/rasterframes/ref/SimpleRasterInfo.scala

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,11 @@ case class SimpleRasterInfo(
4444
)
4545

4646
object SimpleRasterInfo {
47+
// Not a fan of this.... need a better abstraction that doesn't put the
48+
// type-specific logic in here.
49+
def apply(key: String, builder: String => SimpleRasterInfo): SimpleRasterInfo =
50+
cache.get(key, builder)
51+
4752
def apply(info: GeoTiffReader.GeoTiffInfo): SimpleRasterInfo =
4853
SimpleRasterInfo(
4954
info.segmentLayout.totalCols,
@@ -76,10 +81,9 @@ object SimpleRasterInfo {
7681
)
7782
}
7883

79-
private[rasterframes]
80-
lazy val cache = Scaffeine()
84+
private lazy val cache = Scaffeine()
8185
.recordStats()
8286
.build[String, SimpleRasterInfo]
8387

8488
def cacheStats = cache.stats()
85-
}
89+
}

core/src/main/scala/org/locationtech/rasterframes/tiles/ProjectedRasterTile.scala

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,12 +72,15 @@ object ProjectedRasterTile {
7272
}
7373
implicit val serializer: CatalystSerializer[ProjectedRasterTile] = new CatalystSerializer[ProjectedRasterTile] {
7474
override val schema: StructType = StructType(Seq(
75-
StructField("tile_context", schemaOf[TileContext], false),
75+
StructField("tile_context", schemaOf[TileContext], true),
7676
StructField("tile", TileType, false))
7777
)
7878

7979
override protected def to[R](t: ProjectedRasterTile, io: CatalystIO[R]): R = io.create(
80-
io.to(TileContext(t.extent, t.crs)),
80+
t match {
81+
case _: RasterRefTile => null
82+
case o => io.to(TileContext(o.extent, o.crs))
83+
},
8184
io.to[Tile](t)(TileUDT.tileSerializer)
8285
)
8386

0 commit comments

Comments
 (0)