OGGM / oggm

Open Global Glacier Model
http://oggm.org
BSD 3-Clause "New" or "Revised" License
217 stars 104 forks source link

slope definition in climate_statistics ? #915

Open lilianschuster opened 4 years ago

lilianschuster commented 4 years ago

In _workflow.py, in the method climate_statistics(), the slope is defined as an arctan of the height difference and length change.
@entity_task(log) def climate_statistics(gdir, add_climate_period=1995):

If we want the slope to be described in degree, we would need np.tan() ?!
To stay consistent with the other slope definitions, it might be best to calculate here aswell the slope ratio (height difference against length change). Suggested code change:

fmaussion commented 4 years ago

Thanks a lot for the report! We discussed this together a while ago, and now I had time to think about it more.

If we want the slope to be described in degree, we would need np.tan() ?!

After some more thought, I don't think so. Since tan(alpha) = y/x, alpha = arctan(y/x).

To stay consistent with the other slope definitions, it might be best to calculate here aswell the slope ratio (height difference against length change).

Yes that's true. After a quick search, we do not seem to be consistent everywhere here yet: I found 12 occurrences or arctan in the codebase. I wonder what's the "correct thing to do" here. I think there are good arguments to use the gradient only for the numerics (although I'll have to get back to Cuffey and Patterson to be sure), but then what about the other cases?

Currently, we use the "atan slope definition" in these places:

So, to conclude, we use the gradient definition for all things related to numerics (bed inversion, forward dynamical model), but the atan definition for diagnostics and statistics.

Now the question is - should we stick to the gradient definition everywhere to be consistent?