Python Forum
Extract data from rasters to plot time-series - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: Extract data from rasters to plot time-series (/thread-12968.html)



Extract data from rasters to plot time-series - zhl - Sep-20-2018

Hi! Start off by stating I'm VERY new to python, so please excuse my utter confusion.

Here's the deal. I have a model that simulates snowpack, which produces rasters (.tif). The model produces one raster for each day of the year, therefore I have 365 snowpack.tif files. I want to make time-series plots at specific points to compare to actual snowpack data from SNOTEL stations.

Is there a script that can efficiently extract the snowpack value at specific points of all the 365 .tif files, and then export that data (say to a .csv file)?

I have a shapefile of the SNOTEL locations (SNOTEL.shp), which lists the latitude and longitude in the attribute table. I'm trying to figure out a script that will read the rows (the latitude and longitude values) in a SNOTEL.shp file's attribute table, which will then tell the script to extract snowpack values from the rasters (snowpack.tif). The raster's are a matrix, so I may need to convert the lat/long to col/row, but the raster does derive lat/long in the attribute table.

Again, sorry if this is confusing and please ask for clarification where needed. Any advice is appreciated.