Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft of Near Real-time Burnt Area Mapping DEA notebook for review #1018

Closed
wants to merge 17 commits into from

Conversation

Matt-dea
Copy link
Collaborator

@Matt-dea Matt-dea commented Mar 31, 2023

Proposed changes

New notebook.

Concerns

Kernel crashes when user requests a large AOI and a large number of images are extracted. Mostly occurs in the Baseline load_ard extract. Not sure if I can use Dask to solve as I need to visualise the images in the following plot.

Checklist (replace [ ] with [x] to check off)

  • Notebook created using the DEA-notebooks template

  • Remove any unused Python packages from Load packages

  • Remove any unused/empty code cells

  • Remove any guidance cells (e.g. General advice)

  • Ensure that all code cells follow the PEP8 standard for code. The jupyterlab_code_formatter tool can be used to format code cells to a consistent style: select each code cell, then click Edit and then one of the Apply X Formatter options (YAPF or Black are recommended).

  • Include relevant tags in the final notebook cell (refer to the DEA Tags Index, and re-use tags if possible)

  • Clear all outputs, run notebook from start to finish, and save the notebook in the state where all cells have been sequentially evaluated

  • If applicable, update the Notebook currently compatible with the NCI|DEA Sandbox environment only line below the notebook title to reflect the environments the notebook is compatible with

  • Test notebook on both the NCI and DEA Sandbox (flag if not working as part of PR and ask for help to solve if needed)

@review-notebook-app
Copy link

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

@review-notebook-app
Copy link

review-notebook-app bot commented Apr 4, 2023

View / edit / reply to this conversation on ReviewNB

geoscience-aman commented on 2023-04-04T05:54:54Z
----------------------------------------------------------------

I'm being pedantic here but perhaps we rename the filename to be in sentence case to be consistent with other notebooks in Real_world_examples/?


Matt-dea commented on 2023-04-18T06:23:21Z
----------------------------------------------------------------

Yep I agree :) Updated

Matt-dea commented on 2023-04-18T07:09:13Z
----------------------------------------------------------------

Although i noticed that some of the other examples are a bit mixed haha, I will keep DEA capitalised

@review-notebook-app
Copy link

review-notebook-app bot commented Apr 4, 2023

View / edit / reply to this conversation on ReviewNB

geoscience-aman commented on 2023-04-04T05:54:55Z
----------------------------------------------------------------

As discussed, I'll let Erin review this text in detail but here are a few comments:

  1. RE: "During active fire events, emergency service providers can derive significant value from mapping Near Real-time burnt area polygons." - are there any examples we can link to for this statement? 
  2. It may be worth adding that NRT is produced < 48 hours after image capture.
  3. This is a stylistic choice, but I prefer long variables name not in italics. For example, the LaTeX equation d\mathrm{NBR: NBR_{baseline} - NBR_{post-fire}} looks a look better IMO.
  4. Typos/spelling mistakes
  • Extra full stop in "Burnt Area mapping using Sentinel-2 data notebook. instead."
  • "visability" - change to visibility

Matt-dea commented on 2023-04-19T00:20:16Z
----------------------------------------------------------------

  1. Instead of linking to examples, I have toned down this section. Erin will probably review further. Thanks!
  2. Excellent point. I have added this point, and replaced the text with the standard DEA NRT blurb.
  3. Sounds good, I have imlpemented for all algorithms.
  4. Updated. Thanks!

@review-notebook-app
Copy link

review-notebook-app bot commented Apr 4, 2023

View / edit / reply to this conversation on ReviewNB

geoscience-aman commented on 2023-04-04T05:54:56Z
----------------------------------------------------------------

Not sure why each dot point does not show on its own line. Also, can link these headings to the corresponding sections in the notebook.


Matt-dea commented on 2023-04-19T00:21:23Z
----------------------------------------------------------------

Thats weird, the dot points appear on their own line for me? I will have to look into this further!

EDIT: Resolved

Matt-dea commented on 2023-04-19T00:22:30Z
----------------------------------------------------------------

As for the links, I agree that is a good idea but see that it is not done in the other notebooks. I will not implement just to make things consistent :)

@review-notebook-app
Copy link

review-notebook-app bot commented Apr 4, 2023

View / edit / reply to this conversation on ReviewNB

geoscience-aman commented on 2023-04-04T05:54:57Z
----------------------------------------------------------------

As discussed, perhaps it is worth adding a word of caution here to say that selecting too big of a ROI might run out of memory depending on where you are running it?


geoscience-aman commented on 2023-04-18T00:19:16Z
----------------------------------------------------------------

To clarify, when I said "where you are running it", I mean how much memory your sandbox environment has.

Matt-dea commented on 2023-04-19T01:52:42Z
----------------------------------------------------------------

Great point, I have added a disclaimer for large AOI's with a suggestion to reduce the AOI or increase the min_gooddata values if a crash occurs.

@robbibt
Copy link
Collaborator

robbibt commented Apr 14, 2023

Hey @Matt-dea and @erin-telfer - will get on this first thing next week, sorry for the delay!

Copy link
Collaborator

To clarify, when I said "where you are running it", I mean how much memory your sandbox environment has.


View entire conversation on ReviewNB

Copy link
Collaborator Author

Yep I agree :)


View entire conversation on ReviewNB

Copy link
Collaborator Author

Although i noticed that some of the other examples are a bit mixed haha, I will keep DEA capitalised


View entire conversation on ReviewNB

Copy link
Collaborator Author

  1. Instead of linking to examples, I have toned down this section. Erin will probably review further. Thanks!
  2. Excellent point. I have added this point, and replaced the text with the standard DEA NRT blurb.
  3. Sounds good, I have imlpemented for all algorithms.
  4. Updated. Thanks!


View entire conversation on ReviewNB

Copy link
Collaborator Author

Thats weird, the dot points appear on their own line for me? I will have to look into this further!


View entire conversation on ReviewNB

Copy link
Collaborator Author

As for the links, I agree that is a good idea but see that it is not done in the other notebooks. I will not implement just to make things consistent :)


View entire conversation on ReviewNB

Copy link
Collaborator

@robbibt robbibt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @Matt-dea, this is awesome work! The notebook is great: nicely documented and clean code, and the outputs are fantastic! I've put a bunch of feedback below - it's all minor stuff, and the notebook is already very close to being ready to publish!

  1. This is a tricky one since the notebook is primarily focused on NRT analysis... but the biggest issue I had was that the use of datetime.today().strftime("%Y-%m-%d") to set nrt_date_end meant that when I re-ran it today on April 19 , the notebook produced no fire polygon results because there wasn't a fire during the analysis period. I think this will be confusing to users as they'll end up with an empty result and wonder if it was something they did wrong... it will probably be better to hard-code nrt_date_end to a specific date that we know includes a nice fire, e.g. nrt_date_end = "2023-03-31", but then provide really clear instructions to set this to nrt_date_end = datetime.today().strftime("%Y-%m-%d") for today's date.

  2. I'd rename Near_Realtime_Burnt_Area_Mapping.ipynb to Burnt_area_mapping_near_real_time.ipynb. That way it will appear side-by-side with the existing notebook and be easier to find.

  3. For the "safety of life decisions" warning, we could consider using an actual alert box like this - I think we could make more of these kind of boxes across DEA Notebooks, they're great for catching attention:

<div class="alert alert-block alert-danger"> <b>IMPORTANT</b>: This notebook and the datasets visualised and produced are not to be used for safety of life decisions. For local updates and alerts, please refer to your state emergency or fire service. </div>

image

  1. Change "Sentinel 2a" and "Sentinel 2b" in the intro to "Sentinel-2A" and "Sentinel-2B"

  2. Rather than using bold in the "Description" contents list, another option could be to hyperlink them instead as we've recently started doing in recent notebooks (although we need to update the template notebook) - each heading has a "#Blah" format anchor link that you can copy from the URL bar if you click on them: e.g.: 1. [Getting Started and Defining an AOI](#1.-Getting-started-and-defining-an-AOI)
    image

  3. This section says the default is -1 but the code says 1:

# Index selection for the Near Real-time image chosen above. The default value of -1 selects the most recent image regardless of suitability.
nrt_img_index = 1
  1. A completely option one: a lot of the notebook is taken up with plotting code - potentially some of this could be simplified by creating a reproducible function that handles the plotting (it could live in dea_tools.plotting), and then re-use that throughout the notebook. The tricky thing would be some of the cells that combine both Landsat and S2 data, but you could probably just run that function seperately on both sources of data rather than having them on the same plot. 😃

@robbibt
Copy link
Collaborator

robbibt commented Apr 19, 2023

Ah, two more related things:

Copy link
Collaborator Author

Great point, I have added a disclaimer for large AOI's with a suggestion to reduce the AOI or increase the min_gooddata values if a crash occurs.


View entire conversation on ReviewNB

erin-telfer and others added 3 commits May 1, 2023 10:23
* Readme update (#1019)

* test this

* permalink to the template notebook

* trying to get the link working

* Update README.rst

* Update README.rst

---------

Co-authored-by: Nathan <95725385+treefern@users.noreply.github.com>

* upgrade docker-compose postgres image version to 13

* Update bandindices.py (#1022)

Added Normalised Difference Turbidity Index to the 'calculate_indices' tool.
NB. acronym 'NDTI' is already in use for Tillage Index. Acronym 'TI' used in lieu.

* Readme Update (#1025)

Updating to include link back to wiki for approving/reviewing pull requests.

* Tiny doc update to remote build trigger (#1026)

* Update trigger_docs.yaml

Add explanation of triggering build in other doc repo

* Formatting suggestions from review

* Fix `pixel_tides` issues when `ds` has no time dimension (#1028)

* Update pixel_tides func to cover edge cases

* Sync with develop branch

* Hard code dimension order instead of getting dims from ds

* Clean code

* Update USAGE.rst (#1029)

I've added a recently accepted manuscript where I used DEA to calulcate Geomedians and show landscape changes. And the relevant years where we've used DEA sandbox in our remote sensing topics at Flidners university.
Additionally added a conference presentation from AEO22 from Earth Observation Australia 2022 in Brisbane,

* Update spellcheck_wordlist.txt

* Update DEA Notebooks directory structure (#1027)

* New interactive apps folder, moved appropriate notebooks inside

* Deleted scientific_workflows

* rename DEA_datasets folder to DEA_products

* updated 17 notebook references from DEA_datasets to DEA_products

* Rename frequently used code

* Fix incorrect repo folders

* Revert to before dir rename

* Rename frequently used code

* Update readme for DEA_products and How_to_guides

* replace notebook references to Frequently_used_code with How_to_guides

* replace notebook references to frequently used code with How_to_guides

* replaced notebook references to DEA_datasets

* Add readme to interactive apps

* updated Real_world_examples readme

* Remove defunct tests (replaced by nbval --lax)

* Update readme to include interactive apps

* Use stable branch

* Update real world examples format

* Update guided tutorial link

* Update template to remove mention of scientific workflows and Scripts dir

* Fix formatting

* Fix formatting

* Last attempt to fix template notebook formatting

* Final final fix of formatting

---------

Co-authored-by: erialC-P <claire.phillips@ga.gov.au>

* Fix geocoding func to still work if geocoding service is down (#1030)

* Fix geocoding func to still work if geocoding service is down

* Fix format

* Extract coastline app from product notebook and move to Interctive_apps (#1032)

* Update spellcheck_wordlist.txt (#1037)

add:
Ai
Fanson
Fickas
Ronan

* Update USAGE.rst (#1036)

Added Wetlands paper!!

* Replace conference paper with Wetlands paper (#1034)

updated citation list with paper

* Update plotting.py

Added a tool named 'plot_variable_images' primarily for use in the "Burnt_area_mapping_near_real_time" notebook.

* Update plotting.py

* Update plotting.py

* small correction to new tool in plotting.py

Added extra check to handle error when the input xarray dataset has 0 images.

* Update plotting.py

Actioned suggestion to raise error.

* Add Sentinel-2 and Landsat option to animation notebook (#1043)

* Add Sentinel-2 and Landsat option to animation notebook

* Set default resolutions

* Fix bug where choosing combined product didn't trigger data reload

* Update functions to use `odc-geo` and add additional content to tests (#1039)

* Make geobox adding func more generic

* Remove deprecated map_shapefiles func and replace with .explore

* Use odc-geo geobox in xr_animation

* Add geomedian collection option to calculate_indices

* Update animation notebook to use geomedian so we can add it to tests

* Update tests to run on animation notebook

* Fix collection number in segmentation notebook

* Update rgb func to use odc-geo

* Fix attributes being dropped by xr.where, update deprecation version

* Remove assign_crs from rgb (not needed), and add error handling to xr_animation

* Use better error

* Re-run affected notebooks

* Update collection param in ML notebooks

* Add manual reload trigger to layer selection (#1044)

---------

Co-authored-by: Bex Dunn <BexDunn@users.noreply.github.com>
Co-authored-by: Nathan <95725385+treefern@users.noreply.github.com>
Co-authored-by: Pin Jin <pindge.j@gmail.com>
Co-authored-by: Pin Jin <pin.jin@ga.gov.au>
Co-authored-by: Matt-dea <129345253+Matt-dea@users.noreply.github.com>
Co-authored-by: LaurenSchenk1 <125851593+LaurenSchenk1@users.noreply.github.com>
Co-authored-by: Robbi Bishop-Taylor <Robbi.BishopTaylor@ga.gov.au>
Co-authored-by: mdasi00 <91014391+mdasi00@users.noreply.github.com>
Co-authored-by: erialC-P <claire.phillips@ga.gov.au>
@Matt-dea
Copy link
Collaborator Author

Matt-dea commented May 9, 2023

Closing PR. New PR initiated due to complicated conflicts with develop.
All change requested above implemented.

@Matt-dea Matt-dea closed this May 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants