pyTMD
pyTMD copied to clipboard
Can the interpolation range be limited in advance to improve program efficiency?
It's very slow when I use the program to read TPXO9-atlas-v5 and compute tidal elevations. So I check the profile of the code and found that the most time-consuming function is the interpolation part, so I wonder if I can limit the interpolation range in advance to improve operation efficiency?
These two log files are profiles before and after my modification. We can see that it's very useful when the data range we used is small. Can it become universal?
I don't get it what your "modifications" are but from my experience (I'm just a user as well), what takes longest is reading the tide model grids. The code is such that the full grids of all constituents are read before the values for the selected locations are calculated (interpolated or extrapolated). However, I understand @tsutterley as reading only specific subregions around the data would probably complicate things substantially at many other parts of the code (especially when it comes to locations close to the poles/the dateline/Greenwich/... ). This would be nice in some future but surely means a lot of work.
So what improved the speed in my case significantly was creating tailored copies of the constituent files for my region of interest. Reading these subregion files (nlon x nlat = 1095 x 540) instead of the global ones (10800x5401 for TPXO) helps a lot to speed things up.
That is the exact complication which makes this pretty tricky to implement universally. Thanks @DerLude!
on this @lyingTree and @DerLude, I (finally) put in functions to output subsets of FES and TPXO9-atlas files for specific regions of interest in PR #139. Need to be careful handling specific regions of interest (i.e. dateline, prime meridian and poles) if using this functionality as @DerLude mentioned.
@lyingTree I'm (finally) trying to add something to address this in #313