Closed awst-baum closed 5 years ago
Staticlayers are now loaded into memory once the AscatNc object has been initialized, which takes some time though (~30 sec). This is also better for reading performance. The above mentioned error should no longer be a problem.
Thanks for addressing this! One comment: I didn't get that static_layer_path is an 'optional' parameter (which you can set to None) because it's not... optional. Maybe you can give it a default value of 'None' to make that clearer. :)
done 1132726
btw, I don't fully understand the use case of creating multiple AscatNc
object in a loop. An AscatNc
object should created once and than the read
method should be called in a loop.
Stumbled upon it when I tried to reduce running time of our validations. Wolfgang Preimesberger recommended to restrict the variables read to only the ones used in the current validation by passing something like parameters=['sm'] into the constructor. But the variables that are used can vary - so I have to recreate readers tailored to the current validation. I tried to write a unit test for that behaviour and that's where the problem occurred.
Thanks for clarification. Just make sure AscatNc is not re-created in a loop over GPIs.
OK. For our code, it's created for each celery job running on a separate node/process. Also, I just realised I don't have to recreate the reader to set the parameters if I do reader.parameters = ['sm']
I've run into a weird issue with the AscatNc reader which I've managed to reproduce in a unit test:
Test:
Output:
Trace:
Additional output:
Sounds like closing frozen_snow_prob doesn't work as expected? I don't really understand what's going on...