Importing CSV file

I converted a dataset into csv file and added one more column to the said csv file manually. now when I tried importing it back to snap i get the following

Error : No appropriate reader found.

Is there a way to import it a CSV file back to SNap after doing manipulations on it ?

Could you maybe share the first ten lines of both the exported file and the edited one?

Sorry, maybe as csv with the upload function.

I can neither open the original, nor the modified CSV in SNAP.

Maybe for my understanding:
How did you create the original one? Is it based on raster values from pins? And what do you want to do with the new column in SNAP?

I had Sentinel 2 datasets, I did NDVI calculation on those and exported the direct values using FILE —> EXPORT —> CSV.
Then I marked some pixels of interest and concatenated the column to the original file.

The original CSV file can be open in SNAP but after any manipulation SNAP is not reading it back.

For the files I added before.

The CSV files were large(28000 rows) and I only kept the first 10 lines of each.

Could it be possible that manually modifying a CSV file tampers with it’s ability to open in SNAP?

I send you a csv that can be read, as example. I do not know exactly what is the matter, I think it has something to do with the tabulation, but I was not able to solve it. Maybe using this csv as template could work.
new_test_snap.csv (11.8 KB)
I have also coded a Python script to add the necessary lines to the csv to be read by SNAP. I hope it helps too.
write_comments_csv_snap.py (532 Bytes)

1 Like

@abruescas Oh thank you so much…this can be helpful .
I tried the new_test_snap file u gave it opened at first.
Then I modified the file (deleted one row) to see if it still works and while saving it got this error.


further which it did not open in SNAP again.

So I decided to use the python code.
I have a query though. Please excuse me for being novice.
in the python script based on my limited understamding we have to manually enter the values as

f.write(’#sceneRasterWidth=181\n’)
f.write(’…’)

now if this csv file is smaller in size this cud work but i have 28000 rows and more than 5 columns.

could you guide me on how i can proceed with such big dataset ?

SNAP will always read a two-dimensional matrix, for instance my data has 14 values per band. If I assigned (as I did) #sceneRasterWidth=2, only two columns will be written and the rest of the values will be distributed along those two columns. When there are not more values to assign, SNAP will write NaN to complete the matrix. If you know the dimensions of your file, you can change the #sceneRasterWidth=# at your convenience. You dataset has 118 columns, but the important number would be the width to build the two-dimensional square (I guess the 181 width that you obtained when you exported the csv first). I think the problem in your case was the tabulation, maybe @marpet or somebody else have something to say.