Skip to content

Commit 458c3f5

Browse files
authored
Merge pull request #68 from GenericMappingTools/update-tutorials
Update tutorials for the new image_alpha! syntax and GMT transparency issues.
2 parents f013239 + 620143a commit 458c3f5

File tree

2 files changed

+18
-14
lines changed

2 files changed

+18
-14
lines changed

docs/src/gallery/L8cube_img/remotes_L8_cube_img.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ The _cube_ was made with this instructions (but they would only work if you had
77

88
```path = C:/v/LC08_L1TP_204033_20210525_20210529_02_T1/LC08_L1TP_204033_20210525_20210529_02_T1_B;```
99

10-
```cube = cutcube(bands=[2,3,4,5,6,7,10], template=pato, region=(485490,531060,4283280,4330290), save=\"LC08_L1TP_20210525_02_cube.tiff\")```
10+
```cube = cutcube(bands=[2,3,4,5,6,7,10], template=path, region=(485490,531060,4283280,4330290), save="LC08_L1TP_20210525_02_cube.tiff")```
1111

1212
This creates a 3D GeoTIFF file with the companion MTL file saved in it as Metadata. We can see the band info by running the ```reportbands``` function. That information is quite handy because we can, for example, just refer to the _red_ band and it will figure out which layer of the cube contains the Red band.
1313

docs/src/gallery/L8cube_ndvi/remotes_L8_NDVI.md

+17-13
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ Since the data _cube_ holds in it the information about each band, computing the
1111

1212
```Julia
1313
using RemoteS, GMT
14-
N = ndvi("c:/v/LC08_L1TP_20210525_02_cube.tiff");
14+
N = ndvi("LC08_L1TP_20210525_02_cube.tiff");
1515
imshow(N, colorbar=true)
1616
```
1717

@@ -23,7 +23,7 @@ The spectral indices functions all have a ``threshold`` value that will NaNify a
2323
Below we wipe out all values < 0.4 to show only the _Green stuff_
2424

2525
```Julia
26-
N = ndvi("c:/v/LC08_L1TP_20210525_02_cube.tiff", threshold=0.4);
26+
N = ndvi("LC08_L1TP_20210525_02_cube.tiff", threshold=0.4);
2727
imshow(N, dpi=150, colorbar=1)
2828
```
2929

@@ -40,23 +40,23 @@ and see what we get.
4040

4141
```Julia
4242
# Compute a mask based on the condition that threshold >= 0.4
43-
mask = ndvi("c:/v/LC08_L1TP_20210525_02_cube.tiff", threshold=0.4, mask=true);
43+
mask = ndvi("LC08_L1TP_20210525_02_cube.tiff", threshold=0.4, mask=true);
4444
```
4545

4646
To mask out the true color image the best way is to use the ```mask``` as the alpha band.
4747
To make it easier we will recalculate the true color image here.
4848

4949
```Julia
5050
# Recalculate the true color image
51-
Irgb = truecolor("c:/v/LC08_L1TP_20210525_02_cube.tiff");
51+
Irgb = truecolor("LC08_L1TP_20210525_02_cube.tiff");
5252

5353
# Apply the mask
54-
image_alpha!(Irgb, mask);
54+
image_alpha!(Irgb, alpha_band=mask, burn=1);
5555

56-
# And save it to disk so that we can visualize the result
57-
gmtwrite("c:/v/rgb_masked.tiff", Irgb)
56+
# And save it to disk
57+
gmtwrite("rgb_masked.tiff", Irgb)
5858

59-
imshow("c:/v/rgb_masked.tiff")
59+
imshow(Irgb)
6060
```
6161

6262
```@raw html
@@ -70,16 +70,20 @@ To achieve that we use the ``mask`` option with a negative number.
7070

7171
```Julia
7272
# Compute a mask based on the condition that threshold >= 0.4
73-
mask_inv = ndvi("c:/v/LC08_L1TP_20210525_02_cube.tiff", threshold=0.4, mask=-1);
74-
image_alpha!(Irgb, mask_inv);
75-
gmtwrite("c:/v/rgb_inv_masked.tiff", Irgb)
73+
mask_inv = ndvi("LC08_L1TP_20210525_02_cube.tiff", threshold=0.4, mask=-1)
74+
;
75+
# Recompute the true color image that was modified by the ``image_alpha!`` step above
76+
Irgb = truecolor("LC08_L1TP_20210525_02_cube.tiff");
77+
78+
image_alpha!(Irgb, alpha_band=mask_inv, burn=1);
79+
gmtwrite("rgb_inv_masked.tiff", Irgb)
7680
```
7781

7882
Plot the green vegetation that passed the NDVI threshold test and the other part, side by side.
7983

8084
```Julia
81-
grdimage("c:/v/rgb_masked.tiff", region=(502380,514200,4311630,4321420), figsize=8, frame=:bare)
82-
grdimage!("c:/v/rgb_inv_masked.tiff", figsize=8, projection=:linear, xshift=8, frame=:bare, show=true)
85+
grdimage("rgb_masked.tiff", region=(502380,514200,4311630,4321420), figsize=8, frame=:bare)
86+
grdimage!("rgb_inv_masked.tiff", figsize=8, projection=:linear, xshift=8, frame=:bare, show=true)
8387
```
8488

8589
```@raw html

0 commit comments

Comments
 (0)