LANDIS-II-Foundation / Extension-Base-Harvest

Base Harvest extension for the LANDIS-II landscape change model.
https://sites.google.com/site/landismodel/extensions/base-harvest
Apache License 2.0
0 stars 7 forks source link

Multiple Repeats #35

Closed rmscheller closed 2 years ago

rmscheller commented 5 years ago

From Eric Gustafson:

In my simulations using MultipleRepeat I am finding that it runs in the first time step, and then executes one repeat in those stands in the next appropriate time step. The prescription is otherwise completely shut off, meaning that the prescription is not initiated in the other allowable time steps, and subsequent repeats (after the first) are not executed. It is behaving as SingleRepeats used to behave. This is apparently a bug. I have not checked to see if the SingleRepeats are working completely correctly, but those prescriptions are at least not being shut off after being executed once, as they once were.

These repeat prescriptions have been problematic for years, and the last version was an attempt to fix them. Possibly SingleRepeats is fixed, but it appears that MultipleRepeats is not. Is it possible that we did not release the final new version, or did we not address MultipleRepeats?

Klemet commented 4 years ago

I'd like to add that I'm having the same issue. While the multiple repeats was working very well for me last year, it's not working anymore; the areas still seem to be harvested, but the timestep for the repetition seem to be ignored. I'll have to work with a previous version.

Klemet commented 2 years ago

The problem also happens with Biomass Harvest.

In Biomass Harvest 4.1, when a multiple repeat is prescribed, the same areas will be harvested at each indicated repeat.

In Biomass Harvest 4.4...I have no idea what's happening. Sometimes it harvest the same zones, and others; sometime just other zones. And not just at the indicated repeat, but also during the timestep between them. I just can't get a grasp of what's happening. This forces me to use Biomass Harvest 4.1 all of the time.

Klemet commented 2 years ago

Here is an example of what I mean:

I've edited the test scenario of Biomass Harvest (here) to make only one prescription, a very simple repeated clearcut:

LandisData  "Biomass Harvest"

>>----------------
>> REQUIRED INPUTS
>>-----------------
Timestep        5

ManagementAreas     ./biomass-harvest_Management_s2e1.gis

Stands          ./biomass-harvest_Stand_s2e1.gis

>> -------------------------
>> HARVESTING PRESCRIPTIONS
>> -------------------------

>>---- PRESCRIPTION_1 ---------------------------------------
Prescription MaxAgeClearcut
    StandRanking    MaxCohortAge
    SiteSelection   Complete
    CohortsRemoved  ClearCut

    MultipleRepeat 20

>> ----------------------------------
>> HARVESTING IMPLEMENTATION 
>> ---------------------------------

    HarvestImplementations
>>  Mgmt Area   Prescription        Harvest Area    BeginTime   EndTime
>>  ---------       ------------        ------------    ----------  --------
    1       MaxAgeClearcut  10% 0           50

>> ------------
>> OUTPUTS
>> ----------

PrescriptionMaps    harvest/biomass-harvest-prescripts-{timestep}.img
BiomassMaps         harvest/biomass-removed-{timestep}.img
EventLog            harvest/biomass-harvest-event-log.csv
SummaryLog      harvest/biomass-harvest-summary-log.csv

Animation good behaviour biomass harvest 4 1

Animation bad behaviour Biomass harvest 4 4

I have absolutly no idea of where the problem lies; but I figure that it's linked to a shared harvest library between Biomass Harvest and Base Harvest.

Klemet commented 2 years ago

Could it be possible to look into this issue ? In effect, it makes using versions superior to 4.1 of biomass and base harvest problematic for repeated prescriptions; but versions 4.1 have this issue that makes planting impossible; so it's a kind of pick your poison between the two.

aruzicka555 commented 2 years ago

Could it be possible to look into this issue ? In effect, it makes using versions superior to 4.1 of biomass and base harvest problematic for repeated prescriptions; but versions 4.1 have this issue that makes planting impossible; so it's a kind of pick your poison between the two.

I have passed this along to my supervisor. We have been busy with a PnET release, but he has directed me to get to this issue as soon as I am able. Hopefully in the next few weeks.

Sorry for the delay!

Klemet commented 2 years ago

Thank you so much for moving things ! I'm sorry for putting pressure on this issue; the consequences of it has just demanded hours and hours of supplementary work for me, and I'm afraid that it would happen to somebody else.

If I can provide more test data, feel free to ask !

aruzicka555 commented 2 years ago

I can't seem to get the Biomass-Harvest scenario you cited to run as is. It fails here:

"2022-06-15 21:54:54,780 - Error at line 51 of file "biomass-succession_SetUp_s2e1.txt": Error reading input value for Shade Class: "SpeciesParameters" is not a valid integer"

When something like this happens, there are probably other issues too. Are you running this scenario as is or are you changing other things around? I am using the most up-to-date build of Biomass-Harvest, Base-Harvest, and Biomass-Succession.

Klemet commented 2 years ago

I've been running this scenario as-is, except for modifying the prescription files as indicated in my message above.

The files seem to have not been updated for a while; be sure of two things when you launch them:

  1. Errors of not a valid integer can often be due to the parameter files being written with . to indicate decimals, while your computer can be set up to read , for decimals (because of the language used). If that's so, you'll have to convert all symboles in the file. In my case, I've just re-downloaded the files, and I'm not having this issue. It seems that in your case, LANDIS-II is not reading the shade classes starting at line 39 for some reason. This might be due to that, since they contain decimals.
  2. You might encounter the second problem of missing Cohort Leaf Removal values. Those must be indicated at the end in the HarvestReductionParameters, since the scenario files haven't been updated for their presence. I've just put a value of 0.1 in the case of all prescriptions, like this:
HarvestReductionParameters
>>  Name        WoodLitter  Litter  Cohort
>>          Reduct      Reduct  Removal
    MaxAgeClearcut  0.5     0.15    0.8   0.1
    PatchCutting    1.0     1.0 1.0     0.1
    SelectiveNorthernHardwood   0.0 0.15    0.85    0.1

Good luck ! Feel free to tell me if you encounter another problem.

aruzicka555 commented 2 years ago

I found the issue. What version of Biomass-Succession are you using? In my version (the latest 6.0), "SpeciesParameters" is not a valid keyword. It is actually looking for the keyword "SpeciesDataFile", and the species parameters are supposed to be moved out into a CSV apparently.

That being said, I was able to run the scenario and I was able to replicate the bug you demonstrated for Biomass-Harvest 4.4 exactly. That is good news, even if it might not seem like it. While I am being pulled in a few directions still, I will continue looking into this.

Klemet commented 2 years ago

Aaaah, that's interesting ! I thought I was using 6.0; but apparently, I was on 5.3. Thank you so much for finding the issue.

And yeah, it's great if you were able to replicate the issue. I understand that you might not have the time to look into it right now; but thank you for taking the time to keep me updated !

aruzicka555 commented 2 years ago

Ok, since reviewing some of my previous code changes and debugging a bit I think I see what is going on here. When Eric and I set out to fix Multiple Repeat a few years ago, he outlined the expected behavior as follows: a multiple repeat prescription will not only harvest the exact same areas after the given interval, but it will also initiate new harvests each time base/biomass harvest is run and these areas are also queued up for repeat harvests after the given interval. Also, areas that are harvested are set aside and not eligible for future harvests except for when it comes time for a repeat harvest. That is why the maps look so odd from one time step to the next. New harvests are being initiated at each time step, and in the case of later time steps repeat harvests are happening as well.

I did my own verification through the debugger but can you verify that this is in fact what is happening? Is this NOT correct behavior? If this is incorrect, I will run it back to Eric and get feedback from him (he is the maintainer of base and biomass harvest).

Klemet commented 2 years ago

Thanks a lot for taking a look into all of this ! I really appreciate it.

Looking back at my results up there, it seems to be a great explanation of what is happening. I really thank you for the insight !

Wherever this is the right behaviour for the module is a complex question. For me, the problem is that it doesn't properly reflect the % of surface to harvest given by the user. For example, if a user asks to harvest 2% of the surface of a certain management area with a multiple-repeat prescription, this % of surface harvested will in practice increase slowly through time, since new areas are added, and the old ones are harvested again and again. It will be 2% only at the first time step; but as soon as we'll come at the end of a period of multiple repeat, more than 2% of the surface will be harvested.

My suggestion to Eric is that the current behaviour should be very clearly explained in the Base Harvest user guide under the "MultipleRepeat" parameter section; but if possible, I'd tend to come back to the older behaviour (present in Base and Biomass Harvest 4.1) which is much more predictable and controllable in my own view.

However, I'd point out that my own research with LANDIS-II necessitate some fine-tuned and controlled harvest prescriptions; which is not the case for many users. Hence, my own needs might not be the most important : ).

Thanks again for this investigation !

aruzicka555 commented 2 years ago

No problem, glad I could help!

I passed along your feedback to Eric and we will be updating the user guides. He also had some advice for harvest prescriptions which I will quote below:

"I would suggest to the user that he put a start and end time to the MultipleRepeat Rx to control his target rate of cutting into the future. That is, once you stop implementing the Rx, the same stands are repeatly cut indefinitely. If that won’t work, then don’t use MultipleRepeat, and instead use regular Rxs which will be repeated as long as the Rx is implemented. The difference is that it won’t necessarily repeat cuts in exactly the same stands. The only goal for MultipleRepeat is to repeatedly cut the same stand in the same way."

I think he means that you can start a multiple repeat and then end it on the very next time step and it will behave the way you want. I just tried it myself by setting the start time to 5 and end time to 6 for your prescription and got the same behavior as your first graphic in the Biomass Harvest 4.1 example. The stands that are initially harvested will continue to be harvested at the interval until the end of the simulation, even if the prescription is no longer active.

I hope this is helpful.

Klemet commented 2 years ago

Thank you very much for passing the message; I did think about this solution, and it's great to read that Eric would propose it too.

Thanks again for all of this hard work ! I think that the issue can now be closed.