Efficiently access data that changes rarely

Hey. I want to run some simulations depending on weather forecasts. The data is used very often so access is performance critical. It also may change, even though this only happens whenever a new forecast is available. It is okay if the currently running simulation is finished before loading the new data. Finally, I want to access these forecasts in an interpolated fashion. I use Interpolations.jl to create interpolation objects.

My question is how I would go about making these interpolations accessible to the rest of my code. I am considering wrapping them in a struct

struct WeatherData{T}
    wind_speed_itp::T
    temperature_itp::T
    # around 10 more of these
end

and then passing them as an argument to my simulation. Is this reasonable or is there a more efficient way of doing this?

I would be grateful for any ideas and suggestions. :slight_smile:

Seems perfectly fine.

2 Likes