srm-ecology / mhwci

https://srm-ecology.github.io/mhwci/
1 stars 0 forks source link

need to be able to filter tables on list of ensembles #1

Closed billspat closed 1 month ago

billspat commented 1 month ago

When creating a summary statistic (avg, median, etc) from a metric, need to be able to specify the ensemble number.

The metrics tables have an 'ensemble' column to use, which is a string/character column with leading zeros, same as the file name from Dr. Kounta's matlab files. the ensemble column has strings like 001, 002, ...010

when creating SQL in duckdb to limit to select ensembles (1, 3, 5, etc) add a new optional WHERE clause, connect with and

send, as a paramter, a list of ensembles as they are stored, as characters like this '001,003,005' the separator here is a comma but could be anything. If the parameters ensembles = '001,003,005' then the sql would be something like

"select * etc 
FROM mhw_table
WHERE ... and contains('001,003,005', ensemble)"

For the template function, add parameter ...,ensemble_list = '001,003,005') and then in the sql template

"select * etc 
FROM mhw_table
WHERE ... and contains('{ensemble_list}', ensemble)"

see contains function

billspat commented 1 month ago

closed with 62adee21723d426bb122859685f2653cff4310e3 and with documentation in 9f2268d8b64b36a04571f3fce0662fd9256d2f8c