-
Notifications
You must be signed in to change notification settings - Fork 283
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
Code solutions for time-dependent hybrid height #6165
Comments
Initial Code suggestionfrom @stephenworsley
Output
|
Comments following above
|
Further comments@pp-mo I tried adding a third month (2063oct + 2063dec + 2064 jan).
But the problem is, the 2-timepoint cube already has a time dimension, but the surface_altitude naturally does not map to it.
so After new-axis processing
So, those won't concatenate even though they do have a common time coordinate, because the surface_altitudes have different dimensions. Reply from @stephenworsleyWould it be sensible to load each file separately and then process and concatenate? Or does the way loading work make this a lot more inefficient? |
Here's the above "clunky solution"== load_raw with separate merge+concatenate steps ...
Results
|
PerformanceMerging and concattenating can happen in any order and give the same result, however, it appears that performance is heavily impacted when this happens. Loading 60 of the above files:
Note: when running against the current, unreleased version of iris, the performance of merge and concatenate is about the same for these files. It should be noted that in this case merging first combines cubes from within the same file and concattenating first involves combining cubes from differerent files. It's unclear if this would An alternate approach where each file is individually merged first, then newaxis is applied, then concatenate is applied, took ~40 seconds in total to run (including loading). This approach is faster, but relies upon the structure of the files, so may be less general. had a significant effect on performance. from pathlib import Path
import iris
from iris.cube import CubeList
from iris.util import new_axis
path = Path("PATH_TO_FILES")
files = list(path.glob("cx209a.*.pp"))
cubes_by_file = CubeList([iris.load_cube(file, constraint="x_wind") for file in files])
processed_cubes = CubeList(
[new_axis(cube, scalar_coord="time", expand_extras=("surface_altitude", "forecast_period")) for cube in cubes_by_file]
)
result = processed_cubes.concatenate_cube() Comparing different file structuresTo account for differences in file structure with respect to the In both cases, merging first proved more efficient than concatenating first, at ~1 second to ~5 seconds (when running the latest version of iris this is closer to ~1 second vs ~2 seconds). It's worth noting that the above approach of merging each file in turn would have been impossible in the case where each file had constant |
Investigating existing loading code, found that multiple factory references (like orography) are already merged on load. This effectively replicates the workaround solution, except the results still need a 'concatenate' after the merge. However, this approach also seems to point to a fairly neat way to do auto-detection. |
Now updated with prototype loading-control object Please take a look @stephenworsley @trexfeathers and see if you like the approach. |
Not really an issue, but a place to record+discuss potential solutions to #5369
Initial approach is code for workaround, but given #6163 can hopefully develop into optional or automatic operation within iris load.
In that context, appropriate API for this will depend on the scope and possible side-effects of the eventual solution.
I.E. it might either be fully automatic or involve FUTURE controls or additional enabling/disabling keywords.
The text was updated successfully, but these errors were encountered: