ML-for-B-E / nevergrad

A Python toolbox for performing gradient-free optimization
https://facebookresearch.github.io/nevergrad/
MIT License
2 stars 0 forks source link

refactoring to download soil data only if unexistant #24

Closed chrichri17 closed 2 years ago

chrichri17 commented 2 years ago

Context

When we launch a simulation, it sometimes fails with pcse.exceptions.PCSEError: Empty CABO file!. We traced back the error to this line of code.

In fact, what happens is that each time we create a new Irrigation object, we download the soil data. Not only is it not effective, it is also error prone. We assume that the retrieve could possibly go wrong due to network error during the simulation.

Solution

Refactor the code by extracting a get_soil_data to download the soil data only if the ec3.soil doesn't exist.