Skip to main content
Question

Database Schema to Custom Writer Format - .EV extension

  • Nov 11, 2015 6:15 PM UTC
  • 6 replies
  • 107 views

Forum|alt.badge.img
I have a custom format I am trying to write to. It's for consumption into a program called Petrel (used for 3D modelling in the oil and gas industry) and ends with a .ev format. Here is a link to more info on the .ev format: http://petrofaq.org/wiki/How_to_import_completion_event_data_in_Petrel#Well_event_file_format

Β 

Β 

The challenge: Going from a structured database format to the following schema.

Β 

Β 

FROM

Β 

Β 

WELL-1 01/01/2004 perforation 4000 4020 .5 0

Β 

WELL-1 01/12/2002 barefoot 3500 .4 -2

Β 

WELL-1 01/01/2005 rework 3600 3900 .380.5

Β 

WELL-2 01/01/2004 perforation 4000 4020 .5 0

Β 

WELL-2 01/12/2002 barefoot 3500 .4 -2

Β 

WELL-2 01/01/2005 rework 3600 3900 .380.5

Β 

Β 

TO:

Β 

Β 

UNITS FIELD

Β 

WELLNAME WELL-1

Β 

--DATE EVENT MD1 MD2 Diameter Skin

Β 

01/01/2004 perforation 4000 4020 .5 0

Β 

01/12/2002 barefoot 3500 .4 -2

Β 

01/01/2005 rework 3600 3900 .380.5

Β 

Β 

WELLNAME WELL-2

Β 

--DATE EVENT MD1 MD2 Diameter Skin

Β 

01/01/2004 perforation 4000 4020 .5 0

Β 

01/12/2002 barefoot 3500 .4 -2

Β 

01/01/2005 rework 3600 3900 .380.5

Β 

Β 

In bold are the static schema/headers. In italics is the dynamic data.

Β 

Β 

The problem is that the output file essentially strips the database 'style' and puts the well name in a row as the header. Then groups the data below it. There is a break then the next well and it's associated data.

Β 

Β 

I thought about some type of fanout but need them in the same text file. It's not quite XML/JSON and not quite CAT.

Β 

Β 

Wanted to put this out to the community in case someone has a creative approach. Otherwise I may have to look at this programmatically.

Β 

Β 

Thanks!

Β 

Β 

Β 

Matt

Β 

Β 

This post is closed to further activity.
It may be an old question, an answered question, an implemented idea, or a notification-only post.
Please check post dates before relying on any information in a question or answer.
For follow-up or related questions, please post a new question or idea.
If there is a genuine update to be made, please contact us and request that the post is reopened.

6 replies

roland.martin
Contributor
Forum|alt.badge.img+11
Hi Matt,

Β 

Β 

I did something similar a while back to convert GTFS to CIF, which is a similar text-based format. My process was as follows:

Β 

1. Use the TEXTLINE writer and build the space (or is it a tab?) delimited lines using a StringConcatenator to populate the text_line_data attribute. Use a counter to add a sequential ID to each line. Also add another attribute called "_wellname" containing the well name

Β 

2. For your "WELLNAME WELL-1" line, you'll need to aggregate all wells by name, and use a similar AttributeCreator, with a _count of "-2" so it comes before the header rows

Β 

3. In parallel, inject the header row by using another AttributeCreator - you'll want a text_line_data value of "--DATE EVENT MD1 MD2 Diameter Skin" and a _count value of "-1" so it comes just before the actual data

Β 

4. Inject the blank rows and file header using a similar process

Β 

5. Sort by _wellname and _count

Β 

Β 

I'm not sure that explanation made a lot of sense, but hopefully the general process of generating headers and then sorting all the data does? Let me know if not!

Β 

Β 

Cheers,

Β 

Roland.

Forum|alt.badge.img
Hi Matt,

Β 

Β 

I did something similar a while back to convert GTFS to CIF, which is a similar text-based format. My process was as follows:

Β 

1. Use the TEXTLINE writer and build the space (or is it a tab?) delimited lines using a StringConcatenator to populate the text_line_data attribute. Use a counter to add a sequential ID to each line. Also add another attribute called "_wellname" containing the well name

Β 

2. For your "WELLNAME WELL-1" line, you'll need to aggregate all wells by name, and use a similar AttributeCreator, with a _count of "-2" so it comes before the header rows

Β 

3. In parallel, inject the header row by using another AttributeCreator - you'll want a text_line_data value of "--DATE EVENT MD1 MD2 Diameter Skin" and a _count value of "-1" so it comes just before the actual data

Β 

4. Inject the blank rows and file header using a similar process

Β 

5. Sort by _wellname and _count

Β 

Β 

I'm not sure that explanation made a lot of sense, but hopefully the general process of generating headers and then sorting all the data does? Let me know if not!

Β 

Β 

Cheers,

Β 

Roland.
Hi @rollo - Your approach was flawless. Took me a second to realize I had to create each header row in parallel but once I got through that works great!

Β 

Β 

I also added a third row (_count = -3) as a blank which injected a blank row between groups.

Β 

Β 

Β 

Β 

Β 


takashi
Celebrity
  • Nov 12, 2015 2:06 AM UTC
Hi Matt,

Β 

Β 

Alternatively you can also concatenate records (data rows) for each well, using the Aggregator.

Β 

Group By: attribute that stores well name

Β 

Attributes to Concatenate: attribute that stores a record

Β 

Separator Character: newline - special character LF(\\n) or CR+LF (\\r\\n)

Β 

Β 

Then concatenate

Β 

"UNITS FIELD[newline]" for the first well / [newline] for other wells,

Β 

common header (2 lines),

Β 

and the concatenated records.

Β 

Β 

Finally write the resulting text strings into a text file with the Text File writer.

Β 

Β 

Takashi

Forum|alt.badge.img
Hi Matt,

Β 

Β 

Alternatively you can also concatenate records (data rows) for each well, using the Aggregator.

Β 

Group By: attribute that stores well name

Β 

Attributes to Concatenate: attribute that stores a record

Β 

Separator Character: newline - special character LF(\\n) or CR+LF (\\r\\n)

Β 

Β 

Then concatenate

Β 

"UNITS FIELD[newline]" for the first well / [newline] for other wells,

Β 

common header (2 lines),

Β 

and the concatenated records.

Β 

Β 

Finally write the resulting text strings into a text file with the Text File writer.

Β 

Β 

Takashi

Hey @takashi. I am trying your approach but I am getting a wonky (yes that is a technical word) output.

I've attached the workbench (template + sample data) below and was hoping you could take a quick look to see where I'm going wrong.

I've bookmarked in green the workflow that works and highlighted in red your workflow.

Workbench: db-to-petrel-ev-format.fmwt

I get pretty stubborn when I can't make things work and even though @rollo s approach works perfect I'm interested in skinning this cat multiple ways in the interest of future projects.


takashi
Celebrity
  • Nov 17, 2015 11:40 PM UTC

Hey @takashi. I am trying your approach but I am getting a wonky (yes that is a technical word) output.

I've attached the workbench (template + sample data) below and was hoping you could take a quick look to see where I'm going wrong.

I've bookmarked in green the workflow that works and highlighted in red your workflow.

Workbench: db-to-petrel-ev-format.fmwt

I get pretty stubborn when I can't make things work and even though @rollo s approach works perfect I'm interested in skinning this cat multiple ways in the interest of future projects.

Hi @matthewbrucker, you have to concatenate "text_line_data" with the Aggregator. Have a look at the attached workspace example: 469-db-to-petrel-ev-format-2.fmwt


Forum|alt.badge.img

Hi @matthewbrucker, you have to concatenate "text_line_data" with the Aggregator. Have a look at the attached workspace example: 469-db-to-petrel-ev-format-2.fmwt

Ok wow, thanks @takashi. That makes perfect sense now. I was aggregating the wrong attribute(s) instead of aggregating the text_line_data as you said. Works like a charm.