You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Would it be possible to allow arbitrary suffixes to the -n flag, instead of just filetypes?
For me, the primary use-case for using the "-n" flag is to specify input files in a way that avoids clogging up the history attribute with dozens and dozens of lines of filenames, making it impossible to read through to see what happened and where something might have gone wrong.
However, sometimes (often, in the datasets I work with), the chunk of the filename that's incrementing numerically isn't at the end. For example, if I'm concatenating hourly files into daily files, they may be named something like temp_1980-03-21_HH:00:00.nc, where HH is the hour from 00 to 23. It would be really great to be able to use the -n flag to compactly generate the filenames.
I think this could be accomplished pretty simply by allowing one additional optional argument to the -n flag, an offset for the position of the numeric_suffix in the filename. For the example, you could then call ncrcat -n 24,2,1,,,16 temp_1980-03-21_00:00:00.nc to indicate that the width-2 numeric field (which goes by 1s from 00 to 23) has 16 characters ahead of it that should be used as the prefix, and everything after it is a suffix, including the filetype (which can be inferred in the normal way). If the offset is allowed to be negative, it could also be specified as -n 24,2,1,,,-9.
(I think it's more intuitive to specify how many characters to skip over, rather than the index of the start of the field itself, but whatever, either way I'd be happy.)
Thanks for considering it!
The text was updated successfully, but these errors were encountered:
Would it be possible to allow arbitrary suffixes to the -n flag, instead of just filetypes?
For me, the primary use-case for using the "-n" flag is to specify input files in a way that avoids clogging up the history attribute with dozens and dozens of lines of filenames, making it impossible to read through to see what happened and where something might have gone wrong.
However, sometimes (often, in the datasets I work with), the chunk of the filename that's incrementing numerically isn't at the end. For example, if I'm concatenating hourly files into daily files, they may be named something like
temp_1980-03-21_HH:00:00.nc
, whereHH
is the hour from 00 to 23. It would be really great to be able to use the -n flag to compactly generate the filenames.I think this could be accomplished pretty simply by allowing one additional optional argument to the -n flag, an offset for the position of the numeric_suffix in the filename. For the example, you could then call
ncrcat -n 24,2,1,,,16 temp_1980-03-21_00:00:00.nc
to indicate that the width-2 numeric field (which goes by 1s from 00 to 23) has 16 characters ahead of it that should be used as the prefix, and everything after it is a suffix, including the filetype (which can be inferred in the normal way). If the offset is allowed to be negative, it could also be specified as-n 24,2,1,,,-9
.(I think it's more intuitive to specify how many characters to skip over, rather than the index of the start of the field itself, but whatever, either way I'd be happy.)
Thanks for considering it!
The text was updated successfully, but these errors were encountered: