ZGIS / semantique

Semantic Querying in Earth Observation Data Cubes
https://zgis.github.io/semantique/
Apache License 2.0
16 stars 6 forks source link

Trigonometric operator functions #18

Closed luukvdmeer closed 1 year ago

luukvdmeer commented 1 year ago

Description

There are currently no built-in univariate operator functions for trigonometric operators like sin and cos. Adding those can be useful for certain applications. It should be easy to add since numpy has built-in function for them.

Additional context

Add any other context or screenshots about the feature request here.

augustinh22 commented 1 year ago

Context: these functions are specifically useful when dealing with satellite geometry angles, which are provided at the pixel level by certain sensor image products (e.g. Sentinel-3, AVHRR). The angles can be used to help mask observations that may have unsuitable viewing angles in relation to the satellite, or, may be a requirement for certain algorithms (e.g. lake surface water temperature estimations).

luukvdmeer commented 1 year ago

@augustinh22 @dtiede @whisperingpixel This is very easy to add, but I am not sure how far I should go. I can add cos, sin and tan, but also arccos, arcsin, arctan, and more. What is useful for remote sensing purposes? I don't want to overdo it. All these functions by the way assume angles in radians. Should there also be a degree to radian conversion function..?

whisperingpixel commented 1 year ago

@luukvdmeer: Thanks a lot. I am not ignoring you but after thinking about it for a while, I came to the conclusion that I can't give a solid answer for this. My thoughts are that the conversion and cos/sin/tan could be useful (but I don't have specific requirements at hands right now). I am not sure whether we can have "too many" options as well - since we don't know what use-cases may come through using it.

dtiede commented 1 year ago

@luukvdmeer @whisperingpixel If we have them, could we do similar operations (harmonic mean) calculations as explained here?: https://developers.google.com/earth-engine/tutorials/community/time-series-modeling#estimate_seasonality_with_a_harmonic_model That would be very interesting

luukvdmeer commented 1 year ago

I have added now sin, cos and tan as a first step.

@dtiede Yes we could do similar operations, but this would probably be a verb (fitting a harmonic model to a time series) or a reducer (computing the harmonic mean of a time series) on its own. To construct this "manually" with the basic building blocks we have would get very complicated I suppose

luukvdmeer commented 1 year ago

Added now are also secant, cosecant and cotangent, since I remember @augustinh22 mentioning she needs those. Conversion functions between degrees and radians are also added.