-1

I have some NetCDF files (sea level anomaly) and I can open them in Python, but how can I extract pixel values of a specific region (square shape) and save the pixel values as CSV file?


enter image description here

the details of files are like this one, sorry for picture bad quality.

and this is one of the files.(Both links are for the same file)

https://gofile.io/d/TVzuSO

https://filebin.net/mxwe3t466wdngzuk

3
  • 2
    Welcome to Geographic Information Systems! Welcome to GIS SE! We're a little different from other sites; this isn't a discussion forum but a Q&A site. Your questions should as much as possible describe not just what you want to do, but precisely what you have tried and where you are stuck trying that. Please check out our short tour for more about how the site works. – Ian Turton Jul 29 '20 at 16:21
  • You should be able to do this using gdal_translate ~ gdal.org/programs/gdal_translate.html#gdal-translate – nmtoken Jul 29 '20 at 16:33
  • If you are using xarray, you may find the example presented in this question useful: stackoverflow.com/questions/58992490/…. Once you have extracted a value at a given geocoordinate, you can simply export the dataset to Pandas dataframe then use their .to_csv() method. – Trevor J. Smith Jul 30 '20 at 2:41
1

You can try using rioxarray & xarray:

If you are able to provide a file, a more targeted example could be given.

EDIT: In case you have lon 0-360, these links should help:

Based on this comment from the moderators:

Your questions should as much as possible describe not just what you want to do, but precisely what you have tried and where you are stuck trying that.

Mind attempting to come up with a solution based on the links referenced here and adding code you have attempted and any errors you have run into to the question?

2
  • thanks for answering. i add a link to the question. – Kourosh Shahryari Jul 30 '20 at 12:20
  • Mind attempting to come up with a solution based on the links referenced here and adding code you have attempted and any errors you have run into to the question? – snowman2 Jul 30 '20 at 13:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.