You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In this example, we will show how the flexibility of the DataFrame concept for raster data allows a simple and intuitive way to extract a time series from Earth observation data. We will start with our @ref:[built-in MODIS data catalog](raster-catalogs.md#using-built-in-experimental-catalogs).
The entire park boundary is contained in MODIS granule h11 v4. We will simply filter on this granule, rather than using a @ref:[spatial relation](vector-data.md#geomesa-functions-and-spatial-relations). The time period selected should show the change in plant vigor as leaves emerge over the spring and into early summer.
39
40
40
41
```python query_catalog
@@ -53,34 +54,30 @@ Now we have a catalog with several months of MODIS data for a single granule. Ho
53
54
54
55
```python read_catalog
55
56
raster_cols = ['B01', 'B02',] # red and near-infrared respectively
Now we have the vector representation of the park boundary alongside the _tiles_ of red and near infrared bands. Next, we need to create a _tile_ representation of the park to allow us to limit the time series analysis to pixels within the park. This is similar to the masking operation demonstrated in @ref:[NoData handling](nodata-handling.md#masking).
67
69
68
-
We do this using two SQL transformations. The first one will reproject the park boundary from coordinates to the MODIS sinusoidal projection. The second one will create a new _tile_ aligned with the imagery containing a value of 1 where the pixels are contained within the park and NoData elsewhere. The code demonstrates that we can use any `rf_` or `st_` function in SQL. For a more thorough demonstration of how Python and SQL codes compare in RasterFrames, see the @ref:[language support section](languages.md).
70
+
We do this using two transformations. The first one will reproject the park boundary from coordinates to the MODIS sinusoidal projection. The second one will create a new _tile_ aligned with the imagery containing a value of 1 where the pixels are contained within the park and NoData elsewhere.
69
71
70
72
```python burn_in
71
-
cr_1 = spark.sql("""
72
-
SELECT *,
73
-
st_reproject(park, 'EPSG:4326', rf_crs(B01).crsProj4) as park_native
74
-
FROM catalog_read
75
-
""")
76
-
cr_1.createOrReplaceTempView('cr_1')
77
-
78
-
cr_2 = spark.sql("""
79
-
SELECT *,
80
-
rf_rasterize(park_native, rf_geometry(B01), 1, rf_dimensions(B01).cols, rf_dimensions(B01).rows) as park_tile
0 commit comments