Open AndrewWittenberg opened 4 years ago
I like this idea!
We do have RETURN=dset and RETURN=dsetpath keywords that gets us some of this, but it's not the same convenience as a rename. RETURN=dset does not result in unique names.
All of these syntaxes fit in the established syntax; either opening the dataset with a name, or renaming it later, in essence applying a setting to an open dataset.
! opening dataset with a name ( do we need this one?)
yes? use my_data_name = "/path/to/file.nc"
! or, opening with /NAME=
yes? use/name=my_data_name = "/path/to/file.nc" ! opening a new file
yes? use coads_climatology
yes? set data/name="my_data_name" 1
! or equivalently, since USE is an alias
yes? use coads_climatology
yes? use/name="my_data_name" 1
I first thought to use the same mechanism as is used for DEFINE DATA/AGG name= and works perfectly. However, it acts like other renaming that we do (set var/name or set axis/name) , and the original dataset name and url is replaced. For reference, the name in question is stored in ds_des_name(iset).
Here we don't really want to replace the name, but only assign a nickname. We'll need to either do this a little differently, or add some logic to save the original name, because of course we still want the original dataset name to appear in data listings and history attributes for netCDF files.
Putting this aside just for the moment - it's easy and we'll get back to it but I think not for the upcoming release.
In Ferret v7.52, the
DEFINE DATA/AGGREGATE
command can be used to assign a name to a dataset, e.g.:I've found these dataset names to be very useful in scripts, when I don't necessarily know the dataset number in the present context.
So I'd propose extending this naming ability to the
SET DATA
command (and its aliases likeUSE
), i.e.:An alternative syntax could be:
The latter syntax would be more consistent with that of
DEFINE DATA/AGGREGATE
, while the former would allow one to assign (or reassign) a name to a dataset that has already been read into Ferret:Maybe that argues for supporting both syntaxes?