IDEMSInternational / epicsawrap

GNU Lesser General Public License v3.0
0 stars 0 forks source link

annual_rainfall_summaries cannot return seasonal_rain or seasonal_length on their own. #45

Closed ChrisMarsh82 closed 8 months ago

ChrisMarsh82 commented 1 year ago

Params: { "country": "zm", "station_id": "test_1", "summaries": [ "seasonal_rain" ] } error: Error in (function (country, station_id, summaries = c(\"annual_rain\", : \n start_rains and at least one of end_season or end_rains is required to calculate seasonal_rain\n"

and Params: { "country": "zm", "station_id": "test_1", "summaries": [ "seasonal_length" ] } error: Error in (function (country, station_id, summaries = c(\"annual_rain\", : \n start_rains and at least one of end_season or end_rains is required to calculate seasonal_length\n"

Both requests work if all the summaries are added.

lilyclements commented 1 year ago

@ChrisMarsh82 this is working as I expected it to work

To get seasonal_anything, then we need to have the start and end of the season

Both requests work if all the summaries are added.

If all the summaries are added, then the start and end dates are calculated and so the seasonal bits can be calculated. We need to have the start and end bits there which is why it throws the error.

ChrisMarsh82 commented 1 year ago

@lilyclements but why can't it calculate that in the background? Why would I need to request more summaries? I am only interested in the start_rains, not anything else.

lilyclements commented 1 year ago

@ChrisMarsh82 If you want just start of rains it should work. If you want anything with seasons then the code needs to know the start and ends date for the season (otherwise how can we get the seasonal length or rainfall amounts). So you need to give definitions for how you want to define your start and end of season to get the seasonal summaries.

ChrisMarsh82 commented 1 year ago

@lilyclements I understand that but I am not sending any more information by requesting more summaries. Although it needs the other summaries it should be a valid request to just ask for each summary individually. The code should be able to deal with each summary individually or any combination.

lilyclements commented 1 year ago

@ChrisMarsh82 sure. You said that:

The code should be able to deal with each summary individually or any combination.

It currently does deal with the summary individually (or in a combination) if it doesn't contain season in the summary option

annual_rainfall_summaries("zm", "test_1", summaries = c("annual_rain")) 
annual_rainfall_summaries("zm", "test_1", summaries = c("start_rains")) 
annual_rainfall_summaries("zm", "test_1", summaries = c("end_rains")) 
annual_rainfall_summaries("zm", "test_1", summaries = c("end_season")) 

From previous discussions we decided to not have seasonal_length work if there’s no parameters read in for it's dependents (start_rains and end_season (or end_rains) variable). Similarly for seasonal_rainfall. However, I don't mind how we want to approach this.

lilyclements commented 10 months ago

TODO:

If seasonal_* are called and start_rains and/or end_* are not in the summaries parameter for annual_rainfall_summaries, then run a check to see if start_rains and end_rains are defined in the json definitions file.

  1. If it is, we can use that to calculate the seasonal_, and not give it in the data output
  2. If it is not, we can trigger an error
lilyclements commented 10 months ago

fixed by #62

lilyclements commented 10 months ago

Leaving this for you to check and close @ChrisMarsh82