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)

3 Likes

@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.

I have been looking for such a solution, Been stuck on a workflow for weeks. Thank you in advance.

I also have an issue with importing a csv file into SNAP

You are more likely to get help if you create a new thread with a title that will allow others who have worked with similar data recognize your issue and tell us how they solved it.

SNAP can import many kinds of CSV data: cruise tracks, images, etc. If you search for ā€œimport csvā€ in SNAPā€™s Help window the first 4 topics listed are for different kinds of data. There should be many other pages that refer back to one of the first 4 topics.

Please tell us the kind of data you wish to import, show us the first few lines of your .csv file, and tell us what isnā€™t working. Do you get some error? Does the import run but produces unexpected values?

2 Likes
point lot lat z
pt_1 18.1516827380 -33.3345010010 8
pt_2 18.1492254045 -33.3578898296 3
pt_3 18.1484192899 -33.3199816119 6
pt_4 18.1506802297 -33.3263336583 5
pt_5 18.1574482240 -33.3766742004 15
pt_6 18.1419413781 -33.3629960297 10
pt_7 18.1497574292 -33.3230970197 6
pt_8 18.1439253008 -33.3450697061 8
pt_9 18.1438469145 -33.3134043911 7
pt_10 18.1427287709 -33.3474192762 4
pt_11 18.1549129622 -33.3673265303 5
pt_12 18.1419207619 -33.3610032169 2

These are discrete bathymetric points, i want to use for prediction.

I get this error

Check you file against the Help page called ā€œCSV File Conventionsā€. You need to use the prescribed names and assign a geometry to ā€œzā€. Quoting the ā€œConventionsā€ page:

If the CSV data set does not provide valid geoinformation as described above, the data set will be rejected as invalid.

1 Like

Let me try that.

Can you provide me with an example of how that would look because i have honestly tired reading through that manual but it doesnt make sense to me. Maybe because i am new to SNAP. I am used to qucikly uploading csv files into softwares without any issues.

If you donā€™t actually need the first column, the SeaDAS track data format is very simple.

I donā€™t need the first column i need the lat long and z values. but am not sure how to go about assigning a geometry to ā€˜zā€™ as you said above. none of the examples given in that manual show a ā€˜zā€™ attribute .

I just tried importing this using seaDas but it didnā€™t work

18.1516827380 -33.3345010010 8
18.1492254045 -33.3578898296 3
18.1484192899 -33.3199816119 6
18.1506802297 -33.3263336583 5
18.1574482240 -33.3766742004 15
18.1419413781 -33.3629960297 10
18.1497574292 -33.3230970197 6
18.1439253008 -33.3450697061 8
18.1438469145 -33.3134043911 7
18.1427287709 -33.3474192762 4
18.1549129622 -33.3673265303 5
18.1419207619 -33.3610032169 2

I actually have been able to import the SeaDas format.