Matlab - Problemas con netcdf

 
Vista:
sin imagen de perfil

Problemas con netcdf

Publicado por Monica (36 intervenciones) el 21/10/2013 17:00:04
Hola a todos!! ... tengo una duda ...
tengo un archivo con extensión *.nc ... este archivo está compuesto de 5 diferentes variables (tiempo, componente u, componente v, ,,,etc)

Necesito cambiarle el nombre a una variable ... por ejemplo que la variable 'tiempo' pase a llamarse 'tempo' ... por ejemplo ..

Yo he usado el ncwrite para cambiar datos ... pero no se como puedo cambiar el nombre de la variable... agradezco si me pueden ayudar...

Hasta luego!!
Y gracias!!
Mónica
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder
Imágen de perfil de JOSE JEREMIAS CABALLERO
Val: 6.975
Oro
Ha mantenido su posición en Matlab (en relación al último mes)
Gráfica de Matlab

Problemas con netcdf

Publicado por JOSE JEREMIAS CABALLERO (5917 intervenciones) el 22/10/2013 14:27:11
Podrias usar la función renameVar.

1
2
3
4
5
6
7
8
9
10
clear all
srcFile = fullfile(matlabroot,'toolbox','matlab','demos','example.nc');
ncdisp('example.nc')
        copyfile(srcFile,'myfile3.nc','f');
        fileattrib('myfile3.nc','+w');
        ncid = netcdf.open('myfile3.nc','WRITE');
        varid = netcdf.inqVarID(ncid,'temperature');
        netcdf.renameVar(ncid,varid,'caballero_temperature');
        netcdf.close(ncid);
        ncdisp('myfile3.nc')





1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
>> nccreate1
Source:
           D:\Program Files\MATLAB\R2012b\toolbox\matlab\demos\example.nc
Format:
           netcdf4
Global Attributes:
           creation_date = '29-Mar-2010'
Dimensions:
           x = 50
           y = 50
           z = 5
Variables:
    avagadros_number
           Size:       1x1
           Dimensions:
           Datatype:   double
           Attributes:
                       description = 'this variable has no dimensions'
    temperature
           Size:       50x1
           Dimensions: x
           Datatype:   int16
           Attributes:
                       scale_factor = 1.8
                       add_offset   = 32
                       units        = 'degrees_fahrenheight'
    peaks
           Size:       50x50
           Dimensions: x,y
           Datatype:   int16
           Attributes:
                       description = 'z = peaks(50);'
Groups:
    /grid1/
        Attributes:
                   description = 'This is a group attribute.'
        Dimensions:
                   x    = 360
                   y    = 180
                   time = 0     (UNLIMITED)
        Variables:
            temp
                   Size:       []
                   Dimensions: x,y,time
                   Datatype:   int16
 
    /grid2/
        Attributes:
                   description = 'This is another group attribute.'
        Dimensions:
                   x    = 360
                   y    = 180
                   time = 0     (UNLIMITED)
        Variables:
            temp
                   Size:       []
                   Dimensions: x,y,time
                   Datatype:   int16
 
Source:
           C:\Users\jeremias\Downloads\myfile3.nc
Format:
           netcdf4
Global Attributes:
           creation_date = '29-Mar-2010'
Dimensions:
           x = 50
           y = 50
           z = 5
Variables:
    avagadros_number
           Size:       1x1
           Dimensions:
           Datatype:   double
           Attributes:
                       description = 'this variable has no dimensions'
    peaks
           Size:       50x50
           Dimensions: x,y
           Datatype:   int16
           Attributes:
                       description = 'z = peaks(50);'
    caballero_temperature
           Size:       50x1
           Dimensions: x
           Datatype:   int16
           Attributes:
                       scale_factor = 1.8
                       add_offset   = 32
                       units        = 'degrees_fahrenheight'
Groups:
    /grid1/
        Attributes:
                   description = 'This is a group attribute.'
        Dimensions:
                   x    = 360
                   y    = 180
                   time = 0     (UNLIMITED)
        Variables:
            temp
                   Size:       []
                   Dimensions: x,y,time
                   Datatype:   int16
 
    /grid2/
        Attributes:
                   description = 'This is another group attribute.'
        Dimensions:
                   x    = 360
                   y    = 180
                   time = 0     (UNLIMITED)
        Variables:
            temp
                   Size:       []
                   Dimensions: x,y,time
                   Datatype:   int16


Saludos.
JOSE JEREMÍAS CABALLERO
Asesorías en Matlab
programador en matlab
Servicios de programación matlab
[email protected]


http://matlabcaballero.blogspot.com

http://www.lawebdelprogramador.com/foros/Matlab/1371532-FORMA_DE_APRENDER_MATLAB.html
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar
sin imagen de perfil

Problemas con netcdf

Publicado por Monica (36 intervenciones) el 22/10/2013 15:09:19
Muchísimas gracias!!! ... resultó ...
al final ha quedado así ....

Mi caso:

ncdisp('vel_viento.nc')
ncid = netcdf.open('vel_viento.nc','WRITE')
varid = netcdf.inqVarID(ncid,'Vwind');
netcdf.renameVar(ncid,varid,'svstr');
netcdf.close(ncid);

Gracias por la ayuda!!

Saludos Cordiales

Mónica
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar
Imágen de perfil de JOSE JEREMIAS CABALLERO
Val: 6.975
Oro
Ha mantenido su posición en Matlab (en relación al último mes)
Gráfica de Matlab

Problemas con netcdf

Publicado por JOSE JEREMIAS CABALLERO (5917 intervenciones) el 22/10/2013 15:17:01
Gracias a ti, por tu pregunta aprendí algo nuevo de matlab. Estuve leyendo los comandos relaciones a netcdf. Y por allí vi algo relacionado a lo que habías preguntado.
Siempre en cada pregunta del foro se aprende de matlab.


Ahorita estoy contestando los demás preguntas del foro, ya que varios días no había entrado al foro, por cuestiones que estaba centrado en mi trabajo.




Saludos.
JOSE JEREMÍAS CABALLERO
Asesorías en Matlab
programador en matlab
Servicios de programación matlab
[email protected]


http://matlabcaballero.blogspot.com

http://www.lawebdelprogramador.com/foros/Matlab/1371532-FORMA_DE_APRENDER_MATLAB.html
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar