R 語言 & NetCDF? (.nc檔)
什麼是NetCDF? (.nc檔)
NetCDF 是常用的大氣海洋資料格式
是一種 self-described data format
也就是所有與檔案內容相關的資訊,都會記錄在檔頭 (header) 中
此資料格式與 NCL 都是 NCAR 的產品
我們將使用R語言來分析NetCDF檔案
R interface
The R Project for Statistical Computing has developed R, a language and environment for statistical computing and graphics.
It provides a wide variety of statistical and graphical techniques, including linear and nonlinear modelling, statistical tests, time series analysis, classification, and clustering.David Pierce has contributed the ncdf4 package for reading netCDF data into R and for creating new netCDF dimensions, variables, and files, or manipulating existing netCDF files from R.
Pavel Michna has contributed another package, RNetCDF, that also provides access to netCDF data and to udunits calendar functions from R.
Robert Hijmans (with additional contributors) has created the R raster package for geographic data analysis and modeling.
The raster package can be used for reading, writing, manipulating, analyzing and modeling gridded spatial data.
The package is especially useful for large datasets that don't fit into memory, because data is processed in chunks. See Introduction to the 'raster' package for more information.
內文推薦了幾個R的套件,我們將選其中 ncdf4
來試用:
實際使用的程式碼 如下:
library(ncdf4)
input_nc <- nc_open("./WRF_2008_regrid.nc")
透過 ncdf4這個包 傳回值是一個多階層的list結構
後續再接上個人需要的操作