[Thread Prev][Thread Next][Index]

[ferret_users] Renaming variable in ensemble



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