plesager / ece3-postproc

Suite of processing tools for EC-Earth3 output
5 stars 8 forks source link

request for a `-u USER` option #13

Closed plesager closed 6 years ago

plesager commented 6 years ago

@oloapinivad wrote in https://github.com/plesager/ece3-postproc/pull/11#issuecomment-369208141

So we would like to change the IFSRESULTS0 and NEMORESULTS0 but only at user level. Probably it is enough to do something like -> if a -u USERexp is specified, apply a sed on the $USER inside the IFSRESULTS0 and NEMORESULTS0 string replacing with the USERexp, without the need of defining an env variable USERexp. In theory, this can work in parallel with ALTDIR, but I am agree that ALTDIR is not very useful in the very end. If you agree, I will implement this in the next days.

plesager commented 6 years ago

Yes go ahead with (1) removing ALTDIR in hiresclim only (may still be useful in ecmean?) and (2) with adding the -u USER option (in hc.sh and _masterhiresclim.sh) to define a USERexp at the command line.

But I am not 100% sold on using sed to handle it, when compared to using an env variable in the config file only: export ${USERexp:=$USER}. What if somebody wants to change something else than $USER? With the sed solution, you have to edit the sed command in _masterhiresclim.sh at the risk of breaking it. With the en variable, you can just decide what USERexp would replace by just changing your config to export ${USERexp:=ANOTHERDEFAULT}. This is way more flexible. Maybe the USERexp flag needs another easy-to-remember name then: alternate, substitute, replacement, token... none as easy to remember than a "-u USER"? On the other hand, this "what if" is very hypothetical, a niche case. So if you prefer and want to go ahead with a sed call, there is no problem.

oloapinivad commented 6 years ago

Hi, I introduced the -u USER using the env variable as you suggested, it seems working fine and we are testing it in https://github.com/oloapinivad/ece3-postproc/commit/9b786d3e3674afd8b1924c26f1237fb61bd9ba1d.

For the moment we kept the export ${USERexp:=$USER} structure but we can further generalize it later (for different replacements). Once we are sure it is working I will do a pull request. Thanks for the help.

oloapinivad commented 6 years ago

I think we can close this issue if everyone is satisfied with the -u flag

plesager commented 6 years ago

Yes I think it is working as you want. I just committed (cad847b) some minor fixes to correctly handle -u in timeseries. In any case, this can be close.