cmerow / rangeModelMetadata

GNU General Public License v3.0
6 stars 1 forks source link

Downstream problems with rmmAutofillEnvironment() when transfer argument is greater than 1 #4

Open hannahlowens opened 4 months ago

hannahlowens commented 4 months ago

I have a model I want to sequentially transfer to different future time points. This part is fine:

rmm <- rmmAutofillEnvironment(rmm,midCentury,transfer=1) # for transfer environment 1
rmm <- rmmAutofillEnvironment(rmm,lateCentury,transfer=2) # for transfer environment 2

but later, when I do rmmCheckFinalize(rmm), it gives me...

Element name '$data$transfer$environment2$resolution' not found in data dictionary!
 Did you mean: '$data$transfer$environment1$resolution'? 

Then, when I try to save rmm as a .csv using `rmmToCSV(cleanRmm, "LeopardCatMetadata.csv")' I get this error:

Error in x[[i]][[j]][[k]] : subscript out of bounds
hannahlowens commented 4 months ago

Subscript out of bounds was my bad. rmmToCSV() is fine. The problem remains with rmmCheckFinalize(). Working through that now.

hannahlowens commented 4 months ago

All functions wrapped in rmmCheckFinalize() now work. However, the problem remains that if there is more than one transfer region, you will get:

Element name '$data$transfer$environment2$resolution' not found in data dictionary!
 Did you mean: '$data$transfer$environment1$resolution'? 

The clunky way to do this would be to add a ton of lines to the data dictionary, but that doesn't seem practical for long-term use. It's possible there's some way to fix this with a more consistent pattern matching algorithm, but nothing comes to mind right now.