[Thread Prev][Thread Next][Index]

Re: [ferret_users] Renaming variable in ensemble



Hi Ryo,

I agree this looks like a bug.  To work correctly the rename would have to go and rename the variables within all of the member datasets, and it does not do that.  Continuing your example:

...

yes? show data/members
     currently SET data sets:
    3> a  (default)  Ensemble aggregation
 name     title                             I         J         K         L         M         N
 MYVAR_ORG
          SST[L=@MAX]                      1:180     1:90      ...       ...       1:2       ...
       (T=01-JAN 00:45:31-DEC 06:34)
 ------------------------------
 MEMBER_DSET
          Member dataset names in Ensembl  ...       ...       ...       ...       1:2       ...
 HISTORY  Global Att *history* in Ensembl  ...       ...       ...       ...       1:2       ...
 CONVENTIONS
          Global Att *Conventions* in Ens  ...       ...       ...       ...       1:2       ...
 
          Member datasets:
      3.1: ./myvar1.nc
      3.2: ./myvar2.nc

yes? show data myvar1
     currently SET data sets:
    1> ./myvar1.nc
 name     title                             I         J         K         L
 MYVAR    SST[L=@MAX]                      1:180     1:90      ...       ...
       (T=01-JAN 00:45:31-DEC 06:34)
 
yes? show data myvar2
     currently SET data sets:
    2> ./myvar2.nc
 name     title                             I         J         K         L
 MYVAR    SST[L=@MIN]                      1:180     1:90      ...       ...
       (T=01-JAN 00:45:31-DEC 06:34)
 


On 8/7/2022 8:10 AM, Ryo Furue wrote:
Dear Ferret users,

It seems that renaming a variable in an ensemble aggregate makes the variable inaccessible through the aggregate:

! Both files contain a variable "myvar".
ensemble ens = {"myvar1.nc", "myvar2.nc"}
set var/name=newname myvar
let myvar = newname/2
list/i=1/j=1 myvar
**ERROR: variable unknown or not in data set: NEWNAME
list/i=1/j=1 newname
**ERROR: variable unknown or not in data set: NEWNAME

even though "SHOW DATA" indicates that renaming has been successful.

It seems that the individual netCDF files are still accessible by the original name, like

list/i=1/j=1 myvar[d=1]

I'm pasting a self-contained example at the end of this message.

I collect multiple files as an ensemble, reshape the variable, and save the result into a single file and I just want to preserve the original name of the variable.  My current workaround is to use a temporary name and then fix the name with ncrename of NCO.

PyFerret v7.63
macOS 12.5 & Linux (CentOS ????)

Ryo
!---------
! create sample datasets
set data coads_climatology
let myvar = sst[L=@MAX]
save/clobber/file=myvar1.nc myvar
let myvar = sst[L=@MIN]
save/clobber/file=myvar2.nc myvar
cancel data/all
cancel var/all

! testing renaming for a single dataset.
set data myvar1.nc
set var/name=myvar_org myvar
let myvar = myvar_org/2
save/clobber/file=tmp1.nc myvar
cancel data/all
cancel var/all

! testing renaming for an ensemble.
ensemble a = {"myvar1.nc", "myvar2.nc"}
set var/name=myvar_org myvar
let myvar = myvar_org/2
save/clobber/file=tmp.nc myvar


[Thread Prev][Thread Next][Index]
Contact Us
Dept of Commerce / NOAA / OAR / PMEL / Ferret

Privacy Policy | Disclaimer | Accessibility Statement