在从ASCII文件生成的.nc文件中添加时间维度

时间:2018-09-19 01:41:41

标签: r raster netcdf

我有tavg10km_reference_reference_1981_001.txt文件,其中包含ascii格式的每日温度数据。我正在尝试将其转换为.nc文件。我使用了writeRaster命令(下面编写的脚本)。

rm(list=ls())
library (raster)
library (ncdf4)
setwd("X:\\try\\")
txt<-raster("X:\\try\\tavg10km_reference_reference_1981_001.txt")
x <- writeRaster(txt, "tavg10km_reference_reference_1981_001.nc")

新文件为:

1 variables (excluding dimension variables):
float tavg10km_reference_reference_1981_001[easting,northing]   
_FillValue: -3.39999995214436e+38
missing_value: -3.39999995214436e+38
long_name: tavg10km_reference_reference_1981_001
min: -21.4279098510742
max: 18.6759605407715

 2 dimensions:
    easting  Size:72
        units: meter
        long_name: easting
    northing  Size:79
        units: meter
        long_name: northing
5 global attributes:
    crs: +proj=utm +zone=45 +datum=WGS84 +units=m +no_defs +ellps=WGS84 +towgs84=0,0,0
    crs_format: PROJ.4
    Conventions: CF-1.4
    created_by: R, packages ncdf4 and raster (version 2.6-7)

但是,它没有时间维度,我想添加时间维度。这是1981-01-01的每日数据。有任何建议! 预先谢谢你!

0 个答案:

没有答案