Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
juliohm committed May 21, 2024
2 parents 4a09bd9 + 37d3893 commit 99741e9
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 9 deletions.
30 changes: 23 additions & 7 deletions 02-geoviz.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -110,13 +110,6 @@ but any vector with the same length can be passed:
viz(img.geometry, color = 1:length(img.A))
```

::: {.callout-note}

Any vector of Julia objects implementing the `ascolors` function can be
passed to the `color` option.

:::

The `alpha` option can be used to control the transparency of each geometry
in the domain:

Expand Down Expand Up @@ -283,6 +276,29 @@ geotable |> viewer

:::

## cbar

Any vector of Julia objects implementing the `getcolors`
function from the [Colorfy.jl](https://github.com/JuliaGraphics/Colorfy.jl)
module can be passed to the `color` option of `viz`/`viz!`.
The final vector of colors will be a function of the `colormap`
and `colorrange` options.

To reproduce this behavior in the colorbar, the framework provides
the `cbar` function. It is similar to Makie's colorbar, but addresses
various practical challenges with `missing` values, units, etc.

```{julia}
grid = CartesianGrid(2, 2)
vals = [1, missing, 3, 4]
cmap = "cividis"
fig = Mke.Figure()
viz(fig[1,1], grid, color = vals, colormap = cmap)
cbar(fig[1,2], vals, colormap = cmap)
fig
```

We are now equipped with a set of visualization functions that can
really improve the speed at which we explore and analyze geospatial data.
These functions provide a consistent set of aesthetic options that we
Expand Down
11 changes: 9 additions & 2 deletions 05-transforms.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,9 @@ values are `missing`. This is the purpose of the `DropMissing` transform:
georef((a=[1,missing,3], b=[4,5,6])) |> DropMissing()
```

The `DropNaN` is an alternative to drop all rows for which the selected column values
are `NaN`.

### Statistical

The framework provides various feature transforms for statistical analysis. We will
Expand Down Expand Up @@ -632,7 +635,11 @@ nt |> viewer
```

The values of the variables are aggregated at geometric intersections using a default aggregation function,
which can be overwritten with an option.
which can be overwritten with an option. Once the geotable is defined over a `Grid`, it is possible to
refine or coarsen the grid with the `Downscale` and `Upscale` transforms.

The `Transfer` of values to a new geospatial domain is another very useful geospatial transform. The
`Aggregate` transform is related, but aggregates the values with given aggregation functions.

## Remarks

Expand All @@ -647,7 +654,7 @@ Some additional remarks:
- One of the major advantages of transforms compared to traditional row/column
access in data science is that they **preserve geospatial information**.
There is no need to keep track of indices in arrays to repeatedly
reattach attributes to geometries.
reattach values to geometries.
- Transforms can be organized into three classes---feature, geometric and
geospatial---depending on how they operate with the `values` and the
`domain` of the geotable:
Expand Down
5 changes: 5 additions & 0 deletions 09-geojoins.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,11 @@ In database-style join, the predicate function `isequal` is applied to arbitrary
columns of tables. In `geojoin`, **geometric predicate** functions are applied to
the `geometry` column of geotables.

The `tablejoin` function can be used for database-style join between a geotable
and a simple table (e.g., `DataFrame`). The result will be a new geotable over a
subset of geometries from the first argument. Please check the documentation for
more details.

:::

::: {.callout-note}
Expand Down
10 changes: 10 additions & 0 deletions 11-interpolation.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,16 @@ hundreds of thousands of measurements and very large grids.

:::

::: {.callout-note}

## Tip for all users

The `InterpolateMissing` transform can be used to interpolate `missing`
values in a geotable using the same algorithm of `InterpolateNeighbors`.
Likewise, the `InterpolateNaN` can be used to interpolate `NaN` values.

:::

## Congratulations!

Congratulations on finishing **Part IV** of the book. The interpolation
Expand Down

0 comments on commit 99741e9

Please sign in to comment.