8000 docs: Fix documentation by framunoz · Pull Request #409 · gee-community/geetools · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

docs: Fix documentation #409

10000 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

Merged
merged 54 commits into from
Jan 3, 2025

Conversation

framunoz
Copy link
Contributor
@framunoz framunoz commented Dec 18, 2024

I realised that many methods have some bugs in their documentation. For instance, getOffsetParams has an example which is not well idented.

This PR aims to fix these errors in the documentation.

The changes are:

  • Fix a lot of typos in documentation.
  • Improve the identation along the methods' documentation.
  • Update examples to the new version (from ee.ImageCollection(‘COPERNICUS/S2_SR’).first().getSTAC() to ee.ImageCollection(‘COPERNICUS/S2_SR’).first().geetools.getSTAC()).
  • Improve typing (for example, getScaleParams returns a dict, instead of dict[str, float] that is the complete typing, or update the wrong typing ee.image to ee.Image).
  • Extend documentation to be more similar to ee-mont (if they correspond).
  • Improve the cross reference (for external libraries, as matplotlib or gee).

Francisco Muñoz and others added 30 commits December 18, 2024 19:42
With this change, the examples will be executed in the documentation
…sor.plot_by_bands and ImageAccessor.plot_by_regions methods
In the past, it was called with the name "indices"
…maskClouds

Change the example into one more fastest, update COPERNICUS/S2_SR to COPERNICUS/S2_SR_HARMONIZED (the first is deprecated) and add a minor todo note to improve an example
In that order it shows in order RGB (instead of BGR)
For the performance of making documentation, I left the examples as code-block as before. Maybe, in other opportunity, they will be a jupyter executable as before
@framunoz framunoz marked this pull request as ready for review December 20, 2024 18:42
@framunoz
Copy link
Contributor Author

I executed nox -s docs and works perfectly. By the way, as I am working in the code space in GitHub, I can not visualize them. I made a lot of changes since the first PR, that are going to be in the description of the PR.

@framunoz
Copy link
Contributor Author

Also, I realised about two things:

  • Some methods uses mutable parameters, for example
def foo(param: list = []): ...

Doing this is dangerous. It is preferible to do something like:

def foo(param: list = None): 
    param = param if param is not None else []
    ...

that is safer.

Do you want to include this changes in this PR?

@framunoz
Copy link
Contributor Author

Also, there are many parameters outdated in many classes. For example, in the method FeatureCollectionAccessor.fromGeoInterface it says that have the parameters crs, and it appears in the example, but the implementation doesn't use (and defines) it. Should I delete these unused parameters?

@framunoz
Copy link
Contributor Author

I run the documentation and it looks really nice. Please give my any comment if you prefer something different. I think the PR is ready to be reviewed.

Copy link
Member
@12rambau 12rambau left a comment

Choose a reason for hiding this comment

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

Some methods uses mutable parameters, for example

We realized that wih Rodrigo some time ago, I would suggest to do it in a follow-up PR

PEP 8 recommends a limit of 72 characters for docstring. It could be quite restrictful for us, but maybe a limitation to 80 or 88 characters it would be fine.

72 character is way to small, we have very long docstring with lots of comments and explainations I would stick to what it is now and make good use of our IDE wrapper. If at some point we really feel it's slowing us down or making the lib complex to use I'll consider changing it.

Also, there are many parameters outdated in many classes.

I kept them to be consistent with the old implementation. If we want to remove them we need to use a deprecation cycle to avoid breaking older code bases and that should definitely be done in another PR. For the one you highlighted that was done to respect the older version of the geojson representation that could include crs but it was dicarded later down the road and now everything is always in 4326.

@framunoz framunoz requested a review from 12rambau January 2, 2025 19:05
@12rambau
Copy link
Member
12rambau commented Jan 3, 2025

The tests should not be failing considering your modifications. I run them several times on my end and it works perfectly fine, it's as if it was unable to load the json file anymore. I'll merge it and it the bug persist, I'll regenerate a key from my google console.

@12rambau 12rambau merged commit c4f151a into gee-community:main Jan 3, 2025
3 of 9 checks passed
@framunoz framunoz deleted the refactor/improve-documentation branch January 4, 2025 00:41
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.

2 participants
0