How to convert a shapefile to netcdf file in arcgis pro or using arcpy?

1741
3
10-10-2022 05:12 AM
Labels (3)
RehanChaudhary
Occasional Contributor

i have a polygon shapefile which contains an attribute table of 15 or more fields. I want to convert this shapefile to a netcdf file while preserving the data attached with shapefile. is there a way to do that within arcgispro or any other ESRI supported system? i know that in arcgispro i can convert shapefile to raster using polygon to raster tool and then i can convert the raster to netcdf using Raster to netcdf tool but i am not sure if the data remains intact in both these conversions.  Any help would be appreciated. i have attached the sample shapefile as well for testing purposes.

 

 

0 Kudos
3 Replies
DanPatterson
MVP Esteemed Contributor

Did you see the netCDF support pages?

An overview of the NetCDF toolset—ArcGIS Pro | Documentation


... sort of retired...
0 Kudos
RehanChaudhary
Occasional Contributor

@DanPatterson thanks for hinting me to that docs page. so now i know that i have to use Table to Netcdf tool. I have exported the table from my shapefile to be used as the input for the tool but i am not sure which fields should be assigned as variables and which should be assigned as dimensions. As far as i understand NetCDF conventions, dimensions should be any physical quantity such as lat, lon or time etc but i dont have any such info in my data. Also how should i store my data's spatial location in netcdf when i dont have lat long field only area fields. 

Can you give me any example related to my data as to what should go into dimensions and variables from the fields of my data?

0 Kudos
RehanChaudhary
Occasional Contributor

I was able to convert my polygon shapefile to netcdf using the following procedure but i am not sure if its the correct path because now the "Make netcdf feature Layer" is not accepting the centroid x and centroid y coordinates as x and y variables if i want to bring back the netcdf file i just created as a feature layer in arcgispro for testing my workflow. 

1) Use the tool " Add Geometry Coordinates" to calculate centroid coordinates for each polygon within the attribute table of polygon shapefile.

2) use the Tool "Make XY layer " to create a layer out of the polygon shapefile.

3) use the "Feature to Netcdf" tool to convert the just created point layer to netcdf file and use centroid x and y as dimensions.

0 Kudos