Hola,

Por si te puede ayudar:

http://stackoverflow.com/questions/29101807/how-to-merge-netcdf-file-into-one
http://stackoverflow.com/questions/18866266/combine-netcdf-files-to-average-the-values-for-variables-in-r

Saludos,
Carlos Ortega
www.qualityexcellence.es



2017-01-09 10:34 GMT+01:00 Isa García Barón <xan...@gmail.com>:

> Buenos días lista,
>
> Lo que quiero es unir archivos netCDF. Tengo varios archivos con las mismas
> características, pero de días consecutivos y me gustaría unir todos.
>
> He probado con las funciones "transNcdfMerge" y "aggregateNcdf", ambas del
> paquete ncdf.tools. Con ninguna de las dos he conseguido nada, a
> continuación os copio el script que he escrito hasta el momento:
>
> setwd(DataDir_geo_cur)
>
> ## lista con todos los archivo netCDF contenido en el directorio:
> files = list.files(DataDir_geo_cur,pattern='*.nc',full.names=TRUE)
>
> ## leemos todos los archivos:
> for(i in seq_along(files)) {
>   assign(paste0("gc",i),nc_open(files[i]))
> }
>
> # ejemplo de uno de los archivos
> gc1
>
> File C:/use/dt_global_allsat_msla_uv_20070905_20140106.nc
> (NC_FORMAT_CLASSIC):
>
>      5 variables (excluding dimension variables):
>         float lat_bnds[nv,lat]
>         float lon_bnds[nv,lon]
>         int crs[]
>             grid_mapping_name: latitude_longitude
>             semi_major_axis: 6371000
>             inverse_flattening: 0
>         int u[lon,lat,time]
>             _FillValue: -2147483647
>             long_name: Geostrophic velocity anomalies: zonal component
>             standard_name:
> surface_eastward_geostrophic_sea_water_velocity_assuming_
> sea_level_for_geoid
>             units: m/s
>             scale_factor: 1e-04
>         int v[lon,lat,time]
>             _FillValue: -2147483647
>             long_name: Geostrophic velocity anomalies: meridian component
>             standard_name:
> surface_northward_geostrophic_sea_water_velocity_assuming_
> sea_level_for_geoid
>             units: m/s
>             scale_factor: 1e-04
>
>      4 dimensions:
>         time  Size:1
>             long_name: Time
>             standard_name: time
>             units: days since 1950-01-01 00:00:00 UTC
>             calendar: julian
>             axis: T
>         lat  Size:720
>             long_name: Latitude
>             standard_name: latitude
>             units: degrees_north
>             bounds: lat_bnds
>             axis: Y
>             valid_min: -90
>             valid_max: 90
>         lon  Size:1440
>             long_name: Longitude
>             standard_name: longitude
>             units: degrees_east
>             bounds: lon_bnds
>             axis: X
>             valid_min: 0
>             valid_max: 360
>         nv  Size:2
>
>     26 global attributes:
>         cdm_data_type: Grid
>         title: DT merged Global Ocean Gridded Geostrophic Velocities
> SSALTO/Duacs L4 product
>         summary: This dataset contains Delayed Time Level-4 geostrophic
> velocities products from multi-satellite observations over Global Ocean.
>         comment: Surface product; Geostrophic Velocities referenced to the
> [1993, 2012] period
>         time_coverage_resolution: P1D
>         product_version: 5.0
>         institution: CNES, CLS
>         project: SSALTO/DUACS
>         references: www.aviso.altimetry.fr
>         contact: av...@altimetry.fr
>         license:
> http://www.aviso.altimetry.fr/fileadmin/documents/data/License_Aviso.pdf
>         platform: Envisat, Geosat Follow On, Jason-1
>         date_created: 2014-02-27 20:27:23
>         history: 2014-02-27 20:27:23:creation
>         Conventions: CF-1.6
>         standard_name_vocabulary:
> http://cf-pcmdi.llnl.gov/documents/cf-standard-names/
> standard-name-table/12/cf-standard-name-table.html
>         geospatial_lat_min: -90
>         geospatial_lat_max: 90
>         geospatial_lon_min: 0
>         geospatial_lon_max: 360
>         geospatial_vertical_min: 0.0
>         geospatial_vertical_max: 0.0
>         geospatial_lat_units: degrees_north
>         geospatial_lon_units: degrees_east
>         geospatial_lat_resolution: 0.25
>         geospatial_lon_resolution: 0.25
>
> ## creamos un vector con todos los archivos abiertos en el environment:
> names = ls(pattern='gc')
>
> ## Intento de unión con la función transNcdfMerge:
> Geo_cur <- transNcdfMerge(names, path.target = DataDir)
>
> Error in convertDateNcdf2R(fileT) : File gc1 is not existent!
>
> ## Intento de unión con la función aggregateNcdf:
> Geo_cur_1 <- aggregateNcdf(names, path.out = DataDir, period=1)
>
> Error in system(command, as.integer(flag), f, stdout, stderr) : character
> string expected as first argument
>
> Espero que podaís ayudarme, muchísimas gracias y feliz año!
>
> *-----------------------------------------------------------
> ------------------------------------------*
> *Isabel García Barón*
> Email: xan...@gmail.com
> PhD Student at AZTI Foundation -  AZTI Fundazioa
> Marine Ecosystems Functioning
> Herrera Kaia, Portualdea z/g 20110 - Pasaia (Gipuzkoa)
>
>         [[alternative HTML version deleted]]
>
> _______________________________________________
> R-help-es mailing list
> R-help-es@r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-help-es
>



-- 
Saludos,
Carlos Ortega
www.qualityexcellence.es

        [[alternative HTML version deleted]]

_______________________________________________
R-help-es mailing list
R-help-es@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-help-es

Responder a