Extracting a timeseries of x,y values from a series of .asc files
3 views (last 30 days)
Show older comments
Matthew Cooper on 3 Apr 2013
I have what I think is a very simple Matlab problem. I need to extract the value of an x,y cell in a series of .asc grid files, and write these values to a matrix.
A more detailed description. I have a grid of values that represent a spatial domain, and each value in the grid represents a meteorological parameter like temperature. Each .asc grid file represents a day. So each file is a grid of daily temperature. I need to write a matlab script that will go through each file (each day), go to a specified row,column in the grid, pull out the value, and then create a time series of the values.
My files are saved in the format: Tair.YYYY.MM.DD.asc. They have a header with 6 lines at top. Tair is air temperature, swe_depth is snow depth. hogg is the name of the met station. (550,21) is the row/column I am interested in.
Here is what I think should work:
for i=1:length(a) Air = textread(a(i).name,'',-1,'headerlines',6); swe = textread(s(i).name,'',-1,'headerlines',6);
hogg(i,1) = Air(550,21);
hogg(i,2) = swe(550,21);
This works, but I end up with a 31x31 matrix instead of a 31x2 matrix which is what I want.
Also, I know that this should be done using arcgridread or maybe textscan, if anyone wants to suggest how to do it better using one of those two functions I am all ears!
Find more on Eigenvalue Problems in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!