-
Notifications
You must be signed in to change notification settings - Fork 5
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
Document Forest Change Detection use-case #10
Comments
Draft of this is available here https://docs.openeo.cloud/usecases/forest-change-detection/ |
Looks pretty good to me, maybe the code snippets need a bit more contexts. Some variable come out of the blue... Anyway, I've already added the corresponding JS code in the last days. I found it interesting that the JS code is so much shorter and was wondering whether this code snippets could be simplified?
|
Indeed, the javascript code is shorter because the fit function there is encoded as a string, which is not supported in Python client. Instead you have to write this python function, which is more verbose. a small improvement that could be done is skipping the intermediate curve_fitting = l2a_bands.fit_curve(
parameters=[1,1,1], # Initial guess of the parameters
dimension="t", # Fit the function along the temporal dimension
function=l2a_bands._get_callback(fit_function, parent_parameters=["data","parameters"])
) A couple of things that could be done in the Python client:
|
The use of _get_callback is the most confusing thing here IMHO and should eventually be fixed. |
@clausmichele : does that work with
? I think that should be
because the parameter name "inside" the child function is "x", not "data" (which is the argument name of "fit_curve") |
Currently it works, if it should be x instead of data we can correct it after SRR2, Sophie is on holiday right now. |
I already made PR for python client Open-EO/openeo-python-client#230 so that the fit_curve calll can be further simplified to curve_fitting = l2a_bands.fit_curve(
parameters=[1,1,1], # Initial guess of the parameters
dimension="t", # Fit the function along the temporal dimension
function=fit_function
) But I guess we should only proceed with that after SRR2 (because that implementation will use parameter name "x" instead of "data") |
Python client PR https://github.com/Open-EO/openeo-python-client/pull/231will make it possible to write def fit_function(x:ProcessBuilder, parameters:ProcessBuilder):
t = 2 * math.pi / 31557600 * x
return parameters[0] + parameters[1] * cos(t) + parameters[2] * sin(t) |
side note: I think the documentation should also mention
somewhere, it is otherwise not obvious where these functions come from |
Quick question: In the JS client examples I'm using the openEO process pi() as there it's easier to use - Any reason this is using the Python pi? Thinking about potential advantages or disadvantages... |
You're right, I'll fix that |
using float pi will be marginally more efficient than openeo process
That being said, I think the effective performance boost of these kind of optimizations will be negligible in practice. |
Also for code like this:
a request should be made to support those dimension_labels and load_result directly in the python client. It's not the intention that users have to work in this ugly generic manner. |
indeed, and we also have this idea to support processes dynamically in addition to statically defined DataCube methdos, e.g.: Open-EO/openeo-python-client#40 (comment) |
FYI: Open-EO/openeo-python-client#230 (no need for also, |
I've updated the doc based on the latest changes https://github.com/openEOPlatform/documentation/blob/main/usecases/forest-change-detection/index.md |
looks a lot better now 👍 minor remark: the fit function is currently called |
I know, but I just wanted to align between Python and Javascript. It's anyway just a style choice, one may choose to use camelCase for functions and snake_case for variables. |
I think it's fine to use language specifics best practices. Names don't need to 100% fit, so feel free to change to fit_function for Python. |
fitFunction has been changed to fit_function which is more pythonic. Closes this #10
I close this, changed from fitFunction to fit_function for Python. |
No description provided.
The text was updated successfully, but these errors were encountered: