Open giovannibrocca opened 11 months ago
Hi @giovannibrocca thank you for opening this issue and apologies for our delay in getting back to you. We just pushed a few changes to the package that we think might help related to your first point where the secondary_weights()
function is returning lots of NA values. Could you try running the code using secondary_weights()
again to see if anything changed? You will probably have to reinstall the package using devtools::install_github("tcarleton/stagg")
in order to get the updated function.
A few additional thoughts:
secondary_weights()
function could still return NA values if the input contains NA values. If you try running it again and there are still lots of NAs can you send a summary of the initial population_2000
layer? overlay_weights()
shouldn't actually be an error that stops the function, so you should still see an output for all of your polygons but for the polygons where weight = NA in the first case or weight = 0 in the second case those values will reflect the area weights not the area * population weight. Are you still getting an output or is the function not returning any values? We are still working through how we want to treat cells with NAs and 0s in the secondary weights files and we plan to discuss this when we meet next week so I'll be in touch after that with additional information.
hi @giovannibrocca -- we made some updates to the package that might help address your concerns. if you are still experiencing issues, please reach out!
I am trying to aggregate ERA5 surface temperatures in June 2000 at the country level weighting by population, using the data described in the code. However, when running overlay_weights(), I get the following error:
"Warning: Warning: some of the secondary weights are NA, meaning weights cannot be calculated and area-weights will be returned"
This happens both in the case in which I do not reclassify the NA values present in the population dataset and in the case in which I do so.
My code is:
population_2000_brick has 2.828406e+07 NA values, so I try to reclassify them to be equal to 0 and run the same code again, but I still get an error.