Feature request: return filenames created after axecution
Added by Elio Campitelli 4 days ago
I believe right now cdo doesn't return anything when running a command. Returning the output files would make cdo much easier to program with, especially for operators with variable output (like split*).
For example, doing this
split_month="$(cdo splitmon data.nc data_month)"
would then allow the user to take the created files and work with them without having to know exactly how many and what their names are.
Replies (4)
RE: Feature request: return filenames created after axecution - Added by Uwe Schulzweida 3 days ago
Hello Elio,
This feature will be available in the next CDO release 2.5.2 for all split* operators.
Cheers,
Uwe
RE: Feature request: return filenames created after axecution - Added by Elio Campitelli 3 days ago
That's amazing, thanks! Would it be possible to extend that to all operators with file output? For the non-split operators it would allow for this idiom:
file_monmean=$(cdo monmean file.nc $(mktemp))
Which would make it easier to work with temporary files instead of having to define it first and use it later.
RE: Feature request: return filenames created after axecution - Added by Uwe Schulzweida 3 days ago
I have implemented this feature for all operators. To avoid unwanted effects for other users, this feature is only activated with the option print_filename or the environment variable CDO_PRINT_FILENAME=true:
file_monmean=$(cdo --print_filename monmean file.nc $(mktemp))
RE: Feature request: return filenames created after axecution - Added by Elio Campitelli 3 days ago
Excellent! Thanks for the wonderful work!