As mdsummer pointed out, you need to give it the output driver to use, in your case: -of netCDF
:
gdalwarp -t_srs '+proj=lonlat +datum=WGS84 +no_defs' -of netCDF c:/tomcat-6.0.36/webapps/ncWMS/layers/RAIN_MM_1hour_ac.nc c:/tomcat-6.0.36/webapps/ncWMS/layers/RAIN_MM_1hour_ac_proj.nc
It's also clearer IMO to use t_srs EPSG:4326
rather than an (incomplete) Proj4 string if you want output in WGS84.
Use something like this, with the high-level tools in the raster
package:
library(raster)
r <- brick("X27.251.228.22.106.3.5.59.nc", varname = "hgt")
r
How does that look? If all seems well, try a plot(r[[1]])
and make sure everything's interpreted correctly, then test
tab <- as.data.frame(r[[1]], xy = TRUE)
Then if all is well, consider taking out the 1-st index subsetting there. See ?raster::as.data.frame
for long and wide shape options. Once in this data.frame/tab form you can easily write to tabular formats.
The fact is that this format is so general, and the way that conventions within that format get used is so open that you almost always will need to do some upfront investigation and massaging. But once you've done that everything can be really simple and efficient.
I highly recommend using high level facilities like raster
, but the upfront cost is in ensuring that the interpretation is correct. There are (some hidden) facilities in raster to deal with almost any 2D+ variable.
Best Answer
GDAL supports NetCDF: http://www.gdal.org/frmt_netcdf.html