-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

asked Jul 29, 2020 at 16:17
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. Commented Jul 29, 2020 at 16:21
  • You should be able to do this using gdal_translate ~ gdal.org/programs/gdal_translate.html#gdal-translate Commented Jul 29, 2020 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. Commented Jul 30, 2020 at 2:41

1 Answer 1

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?

answered Jul 29, 2020 at 20:34
2
  • thanks for answering. i add a link to the question. Commented Jul 30, 2020 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? Commented Jul 30, 2020 at 13:13

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.