StaMPS-Visualizer, SNAP-StaMPS Workflow

Using with ArcGIS, I solved the problem. @falahfakhri, please follow the steps:

  • File/Add data/Add XY Data -> call the edited CSV file.
  • Right click the filename and Data/Export/ select shp

Then open with QGIS. And use the PS Time Series Tool.

4 Likes

@falahfakhri, I have a question for you. Your exported CSV file is very big. How did you export it to CSV? Which code did you use?

@volkan the same as you, provided in the StaMPS/Visualizer manual page, but with a ts plot using a search radius which is huge 100000 or something. On the other hand, as @ABraun pointed out, there are, in addition to the huge search radius, very dense areas of PS…therefore the CSV becomes so large.

What just came into my mind reading your solution @volkan, it seems like, that the problem is somehow the way a shp file is generated by QGIS. In the troubleshooting part of the StaMPS/Visualizer manual page, is a R script which deals with spatial subsetting, thereby a spatial object is made out of the csv. I could easily provide a code where you can enter the csv file and get an output in shp format…you can then try if the QGIS plugin works with that…this way you do not have to do much extra manual steps, but can bind the script into your workflow…send me a “problematic” csv file and I will provide you with the code you can try.

1 Like

@thho When I enlarge the radius, I get an error at the export_res = [lon2 lat2 disp disp_ts]; step. So I cannot create a CSV file.

And yes, I think like you. The problem is probably is the way of creating shp in QGIS.
https://forum.step.esa.int/uploads/default/original/2X/0/036e61477eee08cd7cd4fcce3f1820b155172bb3.csv is my edited CSV file. You can work with it.

As @thho answered, and thanks a lot for the advice, I’ll give a try,

Hi Throsten,

I asked you here, would you please to to take a look if that possible,

@volkan have not tested the plugin, but it should work, concerning your error, please provide a step by step description until you come to this point and a screenshot of your matlab and all the objects within the environment panel to the right. Cheers

processed shp file

kitap1.zip (10.1 KB)

R script

shp_from_csv.R (1.2 KB)

1 Like

Hi @thho

I’m now trying up to use R scripts to create small subset area, I did get this error, after applying the highlighted script

@falahfakhri

Ok I think I got it. Did you use the direct export file, created from matlab or did you use the file you changed afterwards? I think you used the changed file, which you tried to open in QGIS, this wont work…to be honest, I wrote the code not very flexible, I will change this, but until then, use the direct exported csv file, not the changed one, then everything will work, I promise :wink:

1 Like

Your promise is guaranty, Yes indeed it possible to add the unedited CSV, to the QGIS, it is important to increase the number of header line to discard to choose zero as X axis, and zero_1 as y axis,

image

But still, with editing and without editing, the ts plugin not able to create the time series curve of any selected point.

@falahfakhri, ok I think things became a bit messed up during answering your question and @volkan’s…

@falahfakhri: In order to make a spatial subset of the exported csv table from matlab ts plot, you have to use this csv file, no editing of columns, no renaming. What you do after using the R script for subsetting is completely up to you. You can load the table into StaMPS-Visualizer, or try to get it into QGIS and this plugin you use, if you encounter problems here, try the R script I provided for @volkan to build an ESRI shape file from the csv table…we already know that building a shape file (or spatial object) using the xy tool in qgis seems to make trouble later…therfore the R script or do it in ArcGIS manually

concerning your screenshot, I cant deduce what is wrong with your script, I still see, the lat lon files are empty, I also see an error which probably came from copy pasting problems of the code. I can not really check this because your script window (upper left) is showing code of the StaMPS Visualizer user interface and not the script which is meant for spatial subsetting…

Lets try not to mix things up to much, it is already difficult to follow the thread due to the mixing of the StaMPS visualizer App and the ts plugin for qgis, so lets try to ask and answer questions shortly and precisely :slight_smile:
cheers

Hey,
Thank you for this nice tool, i am looking into using it for my visualization but i run into a problem with making the csv in matlab.

I run below code,

ps_plot(‘v-do’, ‘ts’);
% after the plot has appeared magically, set radius and location by clicking into the plot
load parms.mat;
ps_plot(‘v-do’, -1);
load ps_plot_v-do.mat;
lon2_str = cellstr(num2str(lon2));
lat2_str = cellstr(num2str(lat2));
lonlat2_str = strcat(lon2_str, lat2_str);

lonlat_str = strcat(cellstr(num2str(lonlat(:,1))), cellstr(num2str(lonlat(:,2))));
ind = ismember(lonlat_str, lonlat2_str);

disp = ph_disp(ind);
disp_ts = ph_mm(ind,:);
export_res = [lon2 lat2 disp disp_ts];

metarow = [ref_centre_lonlat NaN transpose(day)-1];
k = 0;
export_res = [export_res(1:k,:); metarow; export_res(k+1:end,:)];
export_res = table(export_res);
writetable(export_res,‘stamps_tsexport.csv’)

and although i am not much of a matlab expert:
Lon2_Str and Lat2_str require a matrice called lon2 and lat2 but i have no lists like this as output from stamps.
does anyone have tips how can i go about to generate these input requirements?

have you set a search radius and clicked the plot to select a location? lon2 and lat2 should appear after this step.

aha, i did not see that as a step to be done by me.
sorry i just misread your instructions. thank you for your clarifications!

Greetings,
Gijs

you are welcome…seems that I should be more precise in this step…will add it

Hey @thho i had the app running for a 1 time but after closing and opening again when i added y own project i get this error:

shiny::runApp(‘INSAR/stamps_visualizer_01beta’)
Loading required package: shiny

Attaching package: ‘lubridate’

The following object is masked from ‘package:base’:

date

Error in file(file, “rt”) : invalid ‘description’ argument

do you have any clue what this implies?
i have all packages installed like you instructed.

Greetings,
Gijs

@Gijs, best guess now is, that the way you imported your own data is not as it should…how does your stusi folder looks like? when you are on Unix based OS do

cd /path/to/stusi
ls -R 

and post the output.

i have made a new folder next to maoxian with my csv files in there.
file structure of ls gives:

Greenland_fire Maoxian

ok looks good, and within the csv is like it is exported from matlab with the file ending .csv?

Edit: I suspect there is maybe an other file in the folder…maybe a hidden file, can you check this…