twVolc / PyCamPermanent

Permanent PiCam (SO2) installation project software
GNU General Public License v3.0
2 stars 2 forks source link

Running processing immediately after a previous run seems to overwrite the config file #104

Closed twVolc closed 9 months ago

twVolc commented 9 months ago

I just tried running processing immediately after processing data before. All I changed was adding one extra PCS line. When running the processing it didn't create a new Processed_2 directory, it just overwrit the config file in Processed_1. It doesn't all actually run properly (which I guess is a separate issue, as it prints that No DOAS data point within 2s of image time: 19:51:35. Image is not added to DOAS calibration.

The old line emission rate data are still there, so I haven't lost anything, but a line_3 folder for the new PCS line I drew has been created. This folder s empty (as expected as I stopped early and the processing wasn't processing fully). So for some reason we start to populate the pre-existing processing directory when running immediately after.

ubdbra001 commented 9 months ago

Okay, just to make sure I understand what is going wrong:

  1. The first run is okay, i.e. all outputs are saved as expected in Processed_1
  2. For a second run immediately after the first, the outputs (at least the config stuff) are overwriting the files in Processed_1 rather than being saved in Processed_2

Is the Processed_2 directory being created but nothing is being saved there? Or is it just not created? I guess you didn't see if the data output is also being put in the wrong place given you stopped the run early?

twVolc commented 9 months ago

Yep that's it. I couldn't see a Processed_2 being created.

No data were produced because there seemed to be an error, I think relating to the DOAS data, that meant that it wasn't actually calibrating the data points so no emission rates were being generated (but it was still running and stepping through each image - it wasn't a fatal error, just a warning). But had they been saved, I'm pretty certain they also would have gone in Processed_1 because I created a new ICA line for the second run and this line's folder appeared in Processed_1, just without any data actually being saved there. Presumably if emission rates were generated they would overwrite the old data.

I think this issue is actually related to (or the same as) #34. It seems reloading the directory is a way of getting things going properly, but I guess this isn't ideal.

ubdbra001 commented 9 months ago

Yeah, I just been having a look and your assessment is spot on. Unsurprisingly setting the output directory is done in set_processing_directory function, and as far as I can tell this is only called in the load_seqence function. May be worth switching it so that it instead runs at the start of every processing run?

twVolc commented 9 months ago

May be worth switching it so that it instead runs at the start of every processing run?

Yeh it sounds like that would make sense. Might need a few checks to ensure no issues arise from that, i.e. there's no expectations for that directory to exist earlier on, but I can't see why there would be as I'm relatively sure the first thing saved in that directory is now the config file at the start of the run.

twVolc commented 9 months ago

No data were produced because there seemed to be an error, I think relating to the DOAS data

Just tracing the larger part of the problem, that no data are actually saved, I see this also relates to #38, and I think that probbably what's happening is IfitWorker.reset_self() is being called at some point, either at the end of processing the last run or the start of processing the new run (probably the former), and this means that there are no DOAS data to be processed in this second run. This is a larger issue that I don't think we need to fix here - #38 is probably the place to discuss that.

May be worth switching it so that it instead runs at the start of every processing run?

Hopefully the above issu just gets fixed by what you suggest here.

ubdbra001 commented 9 months ago

Just tracing the larger part of the problem, that no data are actually saved, I see this also relates to #38, and I think that probbably what's happening is IfitWorker.reset_self() is being called at some point, either at the end of processing the last run or the start of processing the new run (probably the former), and this means that there are no DOAS data to be processed in this second run. This is a larger issue that I don't think we need to fix here - #38 is probably the place to discuss that.

Yes, it looks like it is called as part of the finalise_processing function: https://github.com/twVolc/PyCamPermanent/blob/f81ec766676f25c24874f63d31bc86c63eefb581/pycam/so2_camera_processor.py#L3549-L3565