equinor / segyio

Fast Python library for SEGY files.
Other
476 stars 214 forks source link

Converting polygon coordinates inline/xline/depth slices and mask from it #438

Closed KirillSimonov closed 4 years ago

KirillSimonov commented 4 years ago

Dear authors,

Thanks with help for previous issue! Could you please help me with some tricky stuff (if it does not take much time from you) that is prolongation of first issue?

For example, I want to export polygon of some geological body boundary (salt, channel etc.) which were interpreted in Petrel. Owing to your hlep, I m able to produce crossline and inline images from SEG-Y file and now I want to create mask images for these cross/inlines as labelled data for training network. For creation masks I have polygons in Petrel as I mentioned before. They cane be exported in form of ASCII, Zmap + ascii, shapefile etc. I managed to address them using geopandas library. 1) How can I correlate x, y coordinates of polygons in shape files with cube, which is [inline, crossline, depth slice ] now? All data on cube I have both using segyio and Petrel. I attach an image what I have now. 2020-01-13_16h47_54

2) Is there any mean to create labelled images from these polygons like ins Penobscot dataset? If I understood correctly you created mask from these polygons in .xyz extension. For convenience, I attached image form work "Deep Learning Applied to Seismic Facies Classification: a Methodology for Training". 2020-01-09_17h25_59

I understand if it is out of scope of your expertise but I would be glad any suggestions on this task.

Thank you. I appreciate your time


Sincerely, Kirill

jokva commented 4 years ago
  1. The simplest way I suppose is to consider you data a zero-indexed volume, and translate your polygons accordingly. Segyio is aware of line indices, but only to look up the line itself - after that, you get a numpy array which is not aware of your indices. Once you have everything in a zero-based grid, it's just a matter of creating your mask from data[x, y, z].

  2. Segyio only gives you access to the data as arrays, and once that is done is not aware of what you are doing. There are no such capabilities in the library. Once it's an array, it's also basically an image, and for that I suggest you look up techniques on general arrays or images.

KirillSimonov commented 4 years ago

Dear @jokva,

Thank you. I got idea with 2 point. But still not sure on 1.

I did test conversion of polygon in OpendTect, but want to do it for all polygon in python. However, this is only visual inspection. For example, x = 116003.485084 y = 59713.656120 -> inline 5826 crossline 1244 -> inline = 789 crossline = 225 x = 115394.130714 y = 59377.500480 -> inline 5814 crossline 1269 -> inline = 775 crossline = 250 x = 116655.722511 y = 60282.412712 -> inline 5847 crossline 1217-> inline = 808 crossline = 198

I found this formula , but it did not match with this calculations or I am missing something.

Survey parameters: min max X | 105269.86 | 122544.19 Y | 39605.21 | 76201.71

Origin X: 122531.11
Origin Y: 40352.05
End first inline X: 106973.10
End first inline Y: 39618.29
End first crossline X: 120840.95
End first crossline Y: 76188.64 Number of inlines: 1436
Number of crosslines: 624 Inline interval: 25.00
Crossline interval: 25.00
Inline rotation from north: -92.70
CRS is["GK42-13N:Pulkovo 1942, Gauss-Kruger Z13 North Russia".

So could you tell me what is the formula for conversion? I feel that it is easy task, but miss something. Is there dependence on inline rotation angle?

I understand if it is out of scope of your expertise but I would be glad any suggestions on this task.

Thank you. I appreciate your time

Sincerely, Kirill