Skip to content

Commit c0a7a8f

Browse files
authored
ppai/weather-forecasting: add video link + fix links (#9023)
## Description * Add links to video * Fixes relative paths to source files * Fixes broken links * Add titles to notebooks ## Checklist - [ ] I have followed [Sample Guidelines from AUTHORING_GUIDE.MD](https://github.com/GoogleCloudPlatform/python-docs-samples/blob/main/AUTHORING_GUIDE.md) - [ ] README is updated to include [all relevant information](https://github.com/GoogleCloudPlatform/python-docs-samples/blob/main/AUTHORING_GUIDE.md#readme-file) - [ ] **Tests** pass: `nox -s py-3.9` (see [Test Environment Setup](https://github.com/GoogleCloudPlatform/python-docs-samples/blob/main/AUTHORING_GUIDE.md#test-environment-setup)) - [ ] **Lint** pass: `nox -s lint` (see [Test Environment Setup](https://github.com/GoogleCloudPlatform/python-docs-samples/blob/main/AUTHORING_GUIDE.md#test-environment-setup)) - [ ] These samples need a new **API enabled** in testing projects to pass (let us know which ones) - [ ] These samples need a new/updated **env vars** in testing projects set to pass (let us know which ones) - [ ] Please **merge** this PR for me once it is approved. - [ ] This sample adds a new sample directory, and I updated the [CODEOWNERS file](https://github.com/GoogleCloudPlatform/python-docs-samples/blob/main/.github/CODEOWNERS) with the codeowners for this sample
1 parent f34f89b commit c0a7a8f

File tree

6 files changed

+65
-61
lines changed

6 files changed

+65
-61
lines changed

people-and-planet-ai/README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,9 @@ This model uses satellite data to classify what is on Earth. The satellite data
9292

9393
## 🌦 Weather forecasting -- _timeseries regression_
9494

95-
> [![Open in Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/GoogleCloudPlatform/python-docs-samples/blob/main/people-and-planet-ai/weather-forecasting/README.ipynb)
96-
<!-- > [Watch the video in YouTube<br> ![thumbnail](http://img.youtube.com/vi/TODO/0.jpg)](https://youtu.be/TODO) -->
95+
> [![Open in Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/GoogleCloudPlatform/python-docs-samples/blob/main/people-and-planet-ai/weather-forecasting/notebooks/1-overview.ipynb)
96+
>
97+
> [Watch the video in YouTube<br> ![thumbnail](http://img.youtube.com/vi/6-UJzEXMvGY/0.jpg)](https://youtu.be/6-UJzEXMvGY)
9798
9899
This model uses satellite data to forecast precipitation for the next 2 and 6 hours. The satellite data comes from [Google Earth Engine.](https://earthengine.google.com/)
99100

people-and-planet-ai/weather-forecasting/README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
## 🌦 Weather forecasting -- _timeseries regression_
22

3-
> [![Open in Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/GoogleCloudPlatform/python-docs-samples/blob/main/people-and-planet-ai/weather-forecasting/README.ipynb)
4-
<!-- > [Watch the video in YouTube<br> ![thumbnail](http://img.youtube.com/vi/TODO/0.jpg)](https://youtu.be/TODO) -->
3+
> [![Open in Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/GoogleCloudPlatform/python-docs-samples/blob/main/people-and-planet-ai/weather-forecasting/notebooks/1-overview.ipynb)
4+
>
5+
> [Watch the video in YouTube<br> ![thumbnail](http://img.youtube.com/vi/6-UJzEXMvGY/0.jpg)](https://youtu.be/6-UJzEXMvGY)
56
67
This model uses satellite data to forecast precipitation for the next 2 and 6 hours. The satellite data comes from [Google Earth Engine.](https://earthengine.google.com/)
78

people-and-planet-ai/weather-forecasting/notebooks/1-overview.ipynb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
"id": "HtysPAVSvcMg"
3737
},
3838
"source": [
39-
"# 🌦️ Weather forecasting\n",
39+
"# 🌦️ Weather forecasting -- _Overview_\n",
4040
"\n",
4141
"[![Open in Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/GoogleCloudPlatform/python-docs-samples/blob/main/people-and-planet-ai/weather-forecasting/notebooks/1-overview.ipynb)\n",
4242
"\n",
@@ -225,7 +225,7 @@
225225
"This is what we want to predict, so we'll use them for our _labels_.\n",
226226
"But it's also useful for the model to look at the precipitation from the _past_, so we'll also use it as _inputs_.\n",
227227
"\n",
228-
"In the [`serving/data.py`](serving/data.py) file, we defined a function called `get_gpm_sequence` which returns us an `ee.Image` with the precipitation values for the time sequence we give it.\n",
228+
"In the [`serving/data.py`](../serving/data.py) file, we defined a function called `get_gpm_sequence` which returns us an `ee.Image` with the precipitation values for the time sequence we give it.\n",
229229
"Each time step is stored in a different band with the index as a prefix.\n",
230230
"For example, the band corresponding to the first time step in the sequence would be `0_precipitationCal`, and the second time step would be `1_precipitationCal`."
231231
],
@@ -302,7 +302,7 @@
302302
"It includes measurements from the _visible_, _near-infrared_, and _infrared_ spectrum.\n",
303303
"It is a [geostationary](https://en.wikipedia.org/wiki/Geostationary_orbit) satellite, so its orbit is synchronized with the Earth's rotation, and it provides a view centered in the Americas.\n",
304304
"\n",
305-
"In the [`serving/data.py`](serving/data.py) file, we defined a function called `get_goes16_sequence` which returns us an `ee.Image` with the cloud and moisture data for the time sequence we give it."
305+
"In the [`serving/data.py`](../serving/data.py) file, we defined a function called `get_goes16_sequence` which returns us an `ee.Image` with the cloud and moisture data for the time sequence we give it."
306306
],
307307
"id": "y3NRvQndX66i"
308308
},
@@ -367,7 +367,7 @@
367367
"Elevation could also give the model useful information.\n",
368368
"We use the [MERIT Terrain DEM](https://developers.google.com/earth-engine/datasets/catalog/MERIT_DEM_v1_0_3) dataset to get the elvation.\n",
369369
"\n",
370-
"In the [`serving/data.py`](serving/data.py) file, we defined a function called `get_elevation` which returns us an `ee.Image` with the elevation measured in meters."
370+
"In the [`serving/data.py`](../serving/data.py) file, we defined a function called `get_elevation` which returns us an `ee.Image` with the elevation measured in meters."
371371
],
372372
"id": "gqUhsl1UE2Xs"
373373
},
@@ -491,7 +491,7 @@
491491
"\n",
492492
"We chose to predict precipitation for 2 and 6 hours in the future, but it could be anything as long as we have the right _labels_.\n",
493493
"\n",
494-
"In the [`serving/data.py`](serving/data.py) file, we defined a function called `get_labels_image` which returns us an `ee.Image` with bands for each time step of precipitation."
494+
"In the [`serving/data.py`](../serving/data.py) file, we defined a function called `get_labels_image` which returns us an `ee.Image` with bands for each time step of precipitation."
495495
],
496496
"id": "kRZlrlaXYRA0"
497497
},

people-and-planet-ai/weather-forecasting/notebooks/2-dataset.ipynb

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
"id": "HtysPAVSvcMg"
3737
},
3838
"source": [
39-
"# 🌦️ Weather forecasting\n",
39+
"# 🌦️ Weather forecasting -- _Dataset_\n",
4040
"\n",
4141
"[![Open in Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/GoogleCloudPlatform/python-docs-samples/blob/main/people-and-planet-ai/weather-forecasting/notebooks/2-dataset.ipynb)\n",
4242
"\n",
@@ -137,7 +137,7 @@
137137
},
138138
{
139139
"cell_type": "code",
140-
"execution_count": 3,
140+
"execution_count": null,
141141
"metadata": {
142142
"id": "xGXRHJ9TFs24"
143143
},
@@ -282,13 +282,13 @@
282282
"\n",
283283
"Once we have bins for both precipitation and elevation, we combine them into a single \"unique\" bin value to make sure we get all the possible precipitation values for each elevation.\n",
284284
"\n",
285-
"In [`create_dataset.py`](create_dataset.py) we defined a function called `sample_points` that gives us a balanced selction of `(longitude, latitude)` coordinates for a given date."
285+
"In [`create_dataset.py`](../create_dataset.py) we defined a function called `sample_points` that gives us a balanced selction of `(longitude, latitude)` coordinates for a given date."
286286
],
287287
"id": "hWq2BMYMcAEj"
288288
},
289289
{
290290
"cell_type": "code",
291-
"execution_count": 4,
291+
"execution_count": null,
292292
"metadata": {
293293
"colab": {
294294
"base_uri": "https://localhost:8080/"
@@ -369,14 +369,14 @@
369369
"We predefined that all our training examples would be 5 pixels width by 5 pixels height, but we could choose any size as long as the model accepts it.\n",
370370
"We also want all the training examples to be the same size so we can batch them.\n",
371371
"\n",
372-
"In [`create_dataset.py`](create_dataset.py) we defined `get_training_example`, which fetches an `(inputs, labels)` pair for the given date and (longitude, latitude) coordinate.\n",
372+
"In [`create_dataset.py`](../create_dataset.py) we defined `get_training_example`, which fetches an `(inputs, labels)` pair for the given date and (longitude, latitude) coordinate.\n",
373373
"Let's see how a 64x64 patch looks like, since a 5x5 patch will only look like a bunch of random pixels to us."
374374
],
375375
"id": "W5mr765Ahsd5"
376376
},
377377
{
378378
"cell_type": "code",
379-
"execution_count": 5,
379+
"execution_count": null,
380380
"metadata": {
381381
"colab": {
382382
"base_uri": "https://localhost:8080/"
@@ -419,7 +419,7 @@
419419
},
420420
{
421421
"cell_type": "code",
422-
"execution_count": 6,
422+
"execution_count": null,
423423
"metadata": {
424424
"colab": {
425425
"base_uri": "https://localhost:8080/",
@@ -488,7 +488,7 @@
488488
},
489489
{
490490
"cell_type": "code",
491-
"execution_count": 7,
491+
"execution_count": null,
492492
"metadata": {
493493
"colab": {
494494
"base_uri": "https://localhost:8080/",
@@ -578,7 +578,7 @@
578578
},
579579
{
580580
"cell_type": "code",
581-
"execution_count": 24,
581+
"execution_count": null,
582582
"metadata": {
583583
"colab": {
584584
"base_uri": "https://localhost:8080/",
@@ -624,7 +624,7 @@
624624
"outputId": "2a818de7-128e-4200-f196-f629e698d985"
625625
},
626626
"id": "tcD44qxkSSya",
627-
"execution_count": 25,
627+
"execution_count": null,
628628
"outputs": [
629629
{
630630
"output_type": "stream",
@@ -713,11 +713,11 @@
713713
"Local testing works great for creating small datasets and making sure everything works, but to run on a large dataset at scale it's best to use a distributed runner like\n",
714714
"[Dataflow](https://cloud.google.com/dataflow).\n",
715715
"\n",
716-
"We can run [`create_dataset.py`](create_dataset.py) as a script and run it in [Dataflow](https://cloud.google.com/dataflow).\n",
716+
"We can run [`create_dataset.py`](../create_dataset.py) as a script and run it in [Dataflow](https://cloud.google.com/dataflow).\n",
717717
"You can control the number of dates to sample with `--num-dates` _(default=100)_, and the number of bins to use for the stratified sampling with `--num-bins` _(default=10)_.\n",
718718
"\n",
719719
"We are using the same data extraction functions for both training and prediction.\n",
720-
"This means our Dataflow pipelines needs access to the [`serving/weather-data`](serving/weather-data) module.\n",
720+
"This means our Dataflow pipelines needs access to the [`serving/weather-data`](../serving/weather-data) module.\n",
721721
"Since it's a local module that does not live in [PyPI](https://pypi.org), we have to first build the module with [`build`](https://pypa-build.readthedocs.io/en/latest) and then include the package for Dataflow."
722722
],
723723
"id": "YWAI6AetcxRH"
@@ -748,7 +748,7 @@
748748
"outputId": "516fb9b4-328a-4d41-af2a-028448559882"
749749
},
750750
"id": "1NtAJBl0TKyE",
751-
"execution_count": 17,
751+
"execution_count": null,
752752
"outputs": [
753753
{
754754
"output_type": "stream",
@@ -769,8 +769,10 @@
769769
},
770770
"outputs": [],
771771
"source": [
772+
"data_path = f\"gs://{bucket}/weather/data\"\n",
773+
"\n",
772774
"!python create_dataset.py \\\n",
773-
" --data-path=\"gs://{bucket}/weather/data\" \\\n",
775+
" --data-path=\"{data_path}\" \\\n",
774776
" --runner=\"DataflowRunner\" \\\n",
775777
" --project=\"{project}\" \\\n",
776778
" --region=\"{location}\" \\\n",

0 commit comments

Comments
 (0)