Export data from rasters into csv

8099
6
07-25-2017 10:44 AM
AmenehTavakol
New Contributor III

Hello all, 

I have 16 years of data in raster (one raster for every day) and I want to extract them into csv file. Is there a way which I can export them all based on their date while the date is part of the name of every raster? 

The name of files are like this:  "SMD_HIST_200001310000.d01.grb.tif.tif"

Thank you in advance.

0 Kudos
6 Replies
George_Thompson
Esri Frequent Contributor

You may want to move this to a different space for more visibility: https://community.esri.com/community/gis/imagery-and-remote-sensing?sr=search&searchId=d4dcce6e-f698...

--- George T.
0 Kudos
CodyBenkelman
Esri Regular Contributor

This sounds like a slow and painful process - are your rasters large?  Floating point or integer values?  Are there nodata values?  What version of ArcGIS are you using?  Why *.csv format?  Please tell us more about what you are seeking to do.  

0 Kudos
AmenehTavakol
New Contributor III

Hi Cody, 

Yes they are big raster files and I am using ArcGIS 10.5. I need CSV files to do statistical analysis. I need to have a CSV file which have the No. of pixels and for every pixel have the data from every day. I know we can have a point shape file and extract data from raster files for every single point but is there any way (like python code) that can help us and extract the data and save as them as CSV file?

0 Kudos
CodyBenkelman
Esri Regular Contributor

Ameneh

I believe there must be a way to do what you are asking (if not more than one way), but I will be honest that I don't know the best approach.  I can ask others within Esri, but my concern is that exporting to CSV (presumably to do the statistical calculations in some other software) will be slow and difficult, and that there are better ways to do this immediately within ArcGIS (especially if you want to import the results back into ArcGIS when you are done).  

There have been times in my life I have used a wrench to pound on a nail, but only because I did NOT have a proper hammer.  You have a powerful tool box and I want to guide you to use the best tools.

I assume you are seeking to calculate statistics at every pixel.  I don't know if you will then aggregate statistics of neighboring pixels together, or display the results as a raster, etc. but if you can describe your data and your end goals more completely, we can advise you more easily. 

I will ask Esri colleagues for the best way to do these statistical calculations.  Have you looked at the Mosaic Dataset as a structure to compile all of your rasters into one single data structure?  

What is a mosaic dataset?—Help | ArcGIS Desktop 

Cody 

0 Kudos
AmenehTavakol
New Contributor III

Dear Cody, 

I have different data sets all in raster (observed and model-based data), I want to calculate the correlation coefficient between them and graph data, .... I need to have CSV files no need to have raster at the end. I need to extract data from rasters and continue my work on different data sets (for example soil moisture data from observed and model-based data sets). I need to work with numbers not with rasters.

Ameneh

0 Kudos
CodyBenkelman
Esri Regular Contributor

Okay - I have never tried this but based on a quick search I assume this tool would work

Raster to ASCII—Help | ArcGIS Desktop 

you would likely then have to process in some other software to convert to *.csv format

Cody B.