tsutterley / pyTMD

Python-based tidal prediction software
https://pytmd.readthedocs.io
MIT License
137 stars 40 forks source link

Allow cropping "buffer" as a customisable parameter #367

Open robbibt opened 3 days ago

robbibt commented 3 days ago

Currently the automated buffer that is used when crop=True is hard-coded as 4 model pixels on either side of the analysis extent, e.g.: https://github.com/tsutterley/pyTMD/blob/main/pyTMD/io/FES.py#L263

This works well for most cases, but in certain circumstances it can lead to problems with extrapolating from data located outside the clipped bounds: #366

It would be valuable to be able to customise the buffer used to crop constituents, either by specifying the number of model pixels to use for the buffer, or perhaps as an absolute distance in degrees (I realise that bounds does exist, but this requires users to calculate a full bounding box for each analysis, rather than using the built-in bounds calculation). This would allow users to specify a larger buffer, to ensure data is available for valid extrapolation.

robbibt commented 3 days ago

Another possible option could be to overload bounds for this - e.g. pass a four-item tuple to use a custom bounding box (current functionality), or pass a single value to use as the buffer distance?