[Thread Prev][Thread Next][Index]

Re: [ferret_users] Saving multiple variables into netcdf file



Hi,
You can redefine a variable, but first you need to give the original varaible a new name.  SET VARIABLE/NAME does this.
yes? set variable/name=h_snow_in h_snow

yes? let h_snow = h_snow_in*0
yes? set attributes/like=h_snow_in h_snow

yes? save/append/file=ice_model_0sicsit.res.nc h_snow
Any time you define a variable, you'll want to give it attributes - units, title, etc.  You can either do that directly with LET/TITLE= /UNITS= or inherit them from the file variable with the SET ATTRIBUTE command.

Ansley

On 3/21/2014 9:15 AM, Lívia Sancho wrote:
Dear fellows,

I have a netcdf file x.nc with several variables and I have to create another netcdf file (y.nc) with several of the x.nc variables unaltered and a few of them altered. But I have to save them into the y.nc file with the same exact names of the x.nc.

The thing is: when I try to save the unaltered variables, it's ok, but when I change the variables and try to save into the y.nc with the same name as in x.nc, it returns an error.




yes? use ice_model.res.nc
 *** NOTE: Units on axis "xaxis_1" are not recognized: none
 *** NOTE: They will not be convertible:
 *** NOTE: Units on axis "yaxis_1" are not recognized: none
 *** NOTE: They will not be convertible:
 *** NOTE: Units on axis "zaxis_1" are not recognized: none
 *** NOTE: They will not be convertible:
 *** NOTE: Units on axis "zaxis_2" are not recognized: none
 *** NOTE: They will not be convertible:
 *** NOTE: Units on axis "zaxis_3" are not recognized: none
 *** NOTE: They will not be convertible:
 *** NOTE: Units on axis "Time" are not recognized: time level
 *** NOTE: They will not be convertible:

yes?

yes? set mem/size = 1000
 Cached data cleared from memory

yes? sh d
     currently SET data sets:
    1> ./ice_model.res.nc  (default)
 name     title                                I           J         K          L         M      N
 PART_SIZE
          part_size                        1:360     1:200     1:6       1:1       ...       ...
 ALBEDO   albedo                    1:360     1:200     1:6       1:1       ...       ...
 ROUGH_MOM
          rough_mom                     1:360     1:200     1:6       1:1       ...       ...
 ROUGH_HEAT
          rough_heat                      1:360     1:200     1:6       1:1       ...       ...
 ROUGH_MOIST
          rough_moist                     1:360     1:200     1:6       1:1       ...       ...
 T_SURF   t_surf                         1:360     1:200     1:6       1:1       ...       ...
 H_SNOW   h_snow                    1:360     1:200     1:5       1:1       ...       ...
 H_ICE    h_ice                           1:360     1:200     1:5       1:1       ...       ...


yes? save/file=ice_model_0sicsit.res.nc part_size
 LISTing to file ice_model_0sicsit.res.nc

yes?

yes? save/append/file=ice_model_0sicsit.res.nc albedo
 LISTing to file ice_model_0sicsit.res.nc

yes?

yes? save/append/file=ice_model_0sicsit.res.nc rough_mom
 LISTing to file ice_model_0sicsit.res.nc

yes?

yes? save/append/file=ice_model_0sicsit.res.nc rough_heat
 LISTing to file ice_model_0sicsit.res.nc

yes?

yes? save/append/file=ice_model_0sicsit.res.nc rough_moist
 LISTing to file ice_model_0sicsit.res.nc

yes?

yes? save/append/file=ice_model_0sicsit.res.nc t_surf
 LISTing to file ice_model_0sicsit.res.nc

yes?

yes? let h_snow = h_snow*0
yes? save/append/file=ice_model_0sicsit.res.nc h_snow
 **ERROR: stack overflow
 *** NOTE: Check for recursion in variable definitions



Is there anyway to make this work?? Any thoughts??

Regards!

--
Lívia Sancho

Oceanógrafa, BSc
+55 (21) 8574-0843

Mestrado no Programa de Engenharia Civil (PEC/COPPE - UFRJ)
Área de Petróleo e Gás

Universidade Federal do Rio de Janeiro
Laboratório de Métodos Computacionais em Engenharia
http://www.lamce.coppe.ufrj.br/
E-mail: sancho@xxxxxxxxxxxxxxxxxxx
Tel: +55 (21) 3938-8419

Currículo Lattes


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

Privacy Policy | Disclaimer | Accessibility Statement