I am trying to convert a raster file to netcdf, but i get a nearly empty netcdf file (about 4k) every time. I basically follow the instruction, really have no idea what i am missing. I appreciate any suggestions.
What type of raster are you attempting to convert to a netCDF file? Also, what version of ArcMap are you using? When using the "Raster to NetCDF" tool, specify the input raster and the Output netCDF file parameters only (the first two parameters). Make sure all other parameters are blank and run the tool. Any change in behavior of the tool?
Regards, -- Kevin.
Converting a raster to a NetCDF, would require a raster attribute table to create the different dimensions. NetCDFs are N dimensional and other than the lat, lon, and value for each raster. Also consider your original raster, the converted NetCDF will only be visible with the Make NetCDF Raster layer and the tool should recognize the variables set. The output from the NetCDF should be a .nc file, which will be rather small in size compared to a raster.
The NETCdf is going to be like an ascii file with the data in a matrix of sorts, so the normal size convention will not apply. I am not as concerned about the size, but if the variables being selected during the create process are making it read as invalid, then that is the problem. You say the raster has an attribute table, do the values in the field names correspond to normal NETCdf variables or are they unique. I would keep the lat/lon as the same, unless that is actually corrupted. The NetCDF layer has certain variables it is usually expecting. I am not sure what the variable names are you are specifying or if you are trying to push the New NetCDF into another coordinate system. I would consider what coordinate system you are using if you are defining it or the field names as whether they can be used as valid fields. What value are you specifying for the value of the NetCdf?
You can export the attribute table to a .dbf, while opening the attribute table of the original raster. If that is your desire, then that should not be too bad. The NetCDF format is designed to provide a n dimensional look at the data. So if you had landcover pixels for multiple years then the NetCDF may be the format. That way the lat/lon and multiple values could be listed by date and you could spin through the raster by selecting different values. I am not sure if the NetCDF will allow you to access the original attribute table of the landcover data in the manner you are looking for. For instance, normal NetCDF data is water temperatures that are collected over a time period and usually a depth. So then you can select a particular depth and then scroll through each time period. If you only have a Landcover dataset for one year, I am not sure if that will get what you want, but if you simply want to see the information in the landcover raster in a text format there are other ways.
From my limited understanding of Matlab, a text file should work and it does not have to be a NetCDF.