PlanetaryComputerExamples icon indicating copy to clipboard operation
PlanetaryComputerExamples copied to clipboard

Rename, edit and link notebooks

Open tcmetzger opened this issue 4 years ago • 7 comments
trafficstars

This PR updates all tutorial notebooks that are currently in the tutorials folder of the main branch. Two notebooks (census and proximity) have not been merged yet and therefore are not included in this PR. I will update this PR to include those two notebooks once they have been merged.

All notebooks now follow a consistent file naming pattern. This includes numbering all notebooks in the following order:

  1. Reprojecting and Resampling
  2. Coregistration
  3. Mosaicking
  4. Geospatial Classification
  5. Local Tools
  6. Focal Statistics
  7. Surface Tools
  8. Proximity Tools [not yet included in this PR]
  9. Zonal Statistics
  10. Census Data [not yet included in this PR]
  11. Landcover Classification

The basic thoughts behind this order:

  • Notebooks 1 to 4 cover basic operations that are used in many of the subsequent notebooks
  • Notebooks 5 to 9 cover operations that generally follow the categories of the Map Algebra Functions (Local Operations, Focal Operations, Global Operations, and Zonal Operations).
  • The census data notebook (10) is similar to zonal statistics, as much of what happens there is defining and plotting zones and therefore fits in well right behind the Zonal Statistics notebook.
  • The Landcover Classification notebook goes beyond the other notebooks since it introduces PyTorch.

Other than renaming and ordering notebooks, this PR includes the following updates:

  • Add a "Click on this link to go to the next notebook" link at the bottom of each notebook.
  • Check and update external and internal links
  • Edit for stylistic consistency, orthography, and interpunctuation (based on the Microsoft Writing Style Guide).

Since the Landcover Classification was note created by makepath, this PR only changes the filename but leaves the file unchanged otherwise.

tcmetzger avatar Aug 31 '21 05:08 tcmetzger

Thanks. I believe the README links to these notebooks. Can you make sure those links are updated?

TomAugspurger avatar Aug 31 '21 10:08 TomAugspurger

And FYI, proximity has been merged now.

TomAugspurger avatar Aug 31 '21 14:08 TomAugspurger

@TomAugspurger Thanks for your feedback! My recent commits add the proximity notebook and also update the links in README.md.

tcmetzger avatar Aug 31 '21 18:08 tcmetzger

Thanks @TomAugspurger

I'm noticing some error when searching for STAC items using pystac_client. Are there any changes with the API or with the set up on Planetary Computer?

bounds = [-57.151965, -2.530125, -55.710724, -1.179033]

catalog = pystac_client.Client.open(
    "https://planetarycomputer-staging.microsoft.com/api/stac/v1"
)
jrc = catalog.search(collections=["jrc-gsw"], bbox=bounds)

items = list(jrc.get_items())
print(f"Returned {len(items)} Items")
---------------------------------------------------------------------------
NotImplementedError                       Traceback (most recent call last)
/tmp/ipykernel_359/2968004645.py in <module>
      4     "https://planetarycomputer-staging.microsoft.com/api/stac/v1"
      5 )
----> 6 jrc = catalog.search(collections=["jrc-gsw"], bbox=bounds)
      7 
      8 items = list(jrc.get_items())

/srv/conda/envs/notebook/lib/python3.8/site-packages/pystac_client/client.py in search(self, **kwargs)
    166                 'No link with "rel" type of "search" could be found in this catalog')
    167 
--> 168         return ItemSearch(search_link.target, stac_io=self._stac_io, client=self, **kwargs)

/srv/conda/envs/notebook/lib/python3.8/site-packages/pystac_client/item_search.py in __init__(self, url, limit, bbox, datetime, intersects, ids, collections, query, sortby, fields, max_items, method, stac_io, client)
    171         else:
    172             self._stac_io = StacApiIO()
--> 173         self._stac_io.assert_conforms_to(ConformanceClasses.ITEM_SEARCH)
    174 
    175         self._max_items = max_items

/srv/conda/envs/notebook/lib/python3.8/site-packages/pystac_client/stac_api_io.py in assert_conforms_to(self, conformance_class)
    212         """
    213         if not self.conforms_to(conformance_class):
--> 214             raise NotImplementedError(f"{conformance_class} not supported")
    215         else:
    216             return True

NotImplementedError: ConformanceClasses.ITEM_SEARCH not supported

thuydotm avatar Sep 01 '21 03:09 thuydotm

The staging deployment is going through some changes. Does using https://planetarycomputer-staging.microsoft.com/api/stac/v1 work for you?

TomAugspurger avatar Sep 01 '21 11:09 TomAugspurger

Thanks for the insights. The staging doesn't work. "https://planetarycomputer.microsoft.com/api/stac/v1 works though.

thuydotm avatar Sep 01 '21 12:09 thuydotm

@Tom this PR should now be up to date with main. It now also includes the census notebook which I renamed to fit the pattern of the other notebooks. I also added a link to the next notebook at the end, as we have for all the other notebooks. I think this PR is now ready to merge!

tcmetzger avatar Sep 30 '21 18:09 tcmetzger