problem on Raster to Netcdf

4782
12
Jump to solution
07-09-2012 08:58 AM
JianSun1
New Contributor
Hi,

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.

Best,
Jian
0 Kudos
1 Solution

Accepted Solutions
JeffreySwain
Esri Regular Contributor
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.

View solution in original post

0 Kudos
12 Replies
KevinButler1
Esri Contributor
Hi,

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.

Best,
Jian


Jian:

     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.
0 Kudos
JeffreySwain
Esri Regular Contributor
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.
0 Kudos
JianSun1
New Contributor
Jian:

     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.




Hi Kevin, i am converting the file system raster, and i am using arcmap 10. I tried to leave other parameters blank this time, the variable name and x, y diminution automatically filled in sth. and i could not delete them. But i remember i did do the conversion before with only the input and output parameters filled in. But still i end up with the same result. The uncompressed size of the raster is about 15GB, so the nc file with 4KB does not look right.

Thanks for your advice.
0 Kudos
JianSun1
New Contributor
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.


Hi Jeff,
There is a raster attribute table (the lock file, right?) for the file system raster that i am trying to convert. The uncompressed raster file is about 15GB, but the output netcdf is only 4KB, that can not be right i think. Also i can not use the tool make netcdf raster layer, it gives me the error message that dimensions are invalid no matter what i use for x, y dimension. When i convert the raster dataset to netcdf, do i need to adjust the environment settings? For now, i just set the input and output file name, and variable name, x and y dimension. I think i am missing sth. when the file is converted.

Thanks for your time.

Jian
0 Kudos
JeffreySwain
Esri Regular Contributor
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?
JianSun1
New Contributor
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?



Sorry, i should provide more information about my problem. I have a land cover map covering 12 states in midwest of america, the map is in 30 meter resolution, and the field values are between 3 to 18 representing each vegetation class. I would like convert the file from raster to netcdf, so i can further process it.

By right clicking the raster file in table of contents in ArcMap, i can open the attribute table and view it. But i can not find it in my folder or in ArcCatalog. I tried to build the attribute table under data management toolbox, but every time no files are created except the .lock file. Then it is back to the old story, i use the Raster to Netcdf option in multidimension toolbox for the conversion, and i keep the filed name (fml_ibis_01) in the raster file as the variable name for netcdf, and use x, y as X Dimension and Y Dimension name. Again i end up with the 4kb netcdf file, i try to read it in matlab, but it is empty.

I am new to Arcgis, and i am struggle with this problem for several days. Thanks again for your patience and time to answer my question.
0 Kudos
JeffreySwain
Esri Regular Contributor
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.
0 Kudos
JianSun1
New Contributor
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.


Hi, jbswain, i give it up converting the file to netcdf directly, and did another way around, convert it to txt file (very big file, 15GB), and process it further with ncl. Thanks for your time and reply.

Best,
0 Kudos
JeffreySwain
Esri Regular Contributor
Glad it worked out.
0 Kudos