Database, Cloud, & IT

How to Delete DCA Wrangler Models in Petro.ai – Part 1

Have you ever wondered how you can remove DCA Wrangler models that are stored in the Petro.ai Database?

Dream no longer!

You will need a couple of things:

1. Well Decline Curve or Type Curve models created with the DCA Wrangler

2. Robo 3T (free) or Studio 3T (easier use, not free).

3. Valid Petro.ai Database Connection.

Quick FYI – Petro.ai Collections (Tables)

prod.WellDeclineCurveModels – Decline Curve Models saved using Single-Well or Multi-Well mode

prod.TypeCurveModels – Type Curve Models saved using Type Curve mode

Robo 3T and Studio 3T

Code for Single-Well/Multi-Well (Robo 3T)

/*
This script will DELETE all decline curve models listed below. 
Change "false" below to "true" in order to delete, otherwise it will just count (for safety)
*/

//List all model names, in quotes and separated by commas:
var modelNames = [
    'MyModel1',
    'MyModel2',
]
//////////////////////////////////////////////////////
var I_WOULD_LIKE_TO_DELETE_ALL_MODELS = false;
//////////////////////////////////////////////////////
modelNames.forEach((modelName) => {
    if (I_WOULD_LIKE_TO_DELETE_ALL_MODELS) {
        printjson({
            _id: modelName,
            modelCount: db.getCollection("prod.WellDeclineCurveModels").deleteMany({'modelName': modelName}),
        });
    }
    else {
        printjson({
            _id: modelName,
            modelCount: db.getCollection("prod.WellDeclineCurveModels").count({'modelName': modelName}),
        });
    }
});

Code for Single-Well/Multi-Well (Studio 3T)

//Define Database Below
use petroai;
/*
This script will DELETE all decline curve models listed below. 
Change "false" below to "true" in order to delete, otherwise it will just count (for safety)
*/
//List all model names, in quotes and separated by commas:
var modelNames = [
    'MyModel1',
    'MyModel2',
]
//////////////////////////////////////////////////////
var I_WOULD_LIKE_TO_DELETE_ALL_MODELS = false;
//////////////////////////////////////////////////////
modelNames.forEach((modelName) => {
    if (I_WOULD_LIKE_TO_DELETE_ALL_MODELS) {
        printjson({
            _id: modelName,
            modelCount: db.getCollection("prod.WellDeclineCurveModels").deleteMany({'modelName': modelName}),
        });
    }
    else {
        printjson({
            _id: modelName,
            modelCount: db.getCollection("prod.WellDeclineCurveModels").count({'modelName': modelName}),
        });
    }
});

Examples:

Robo 3T

Studio 3T – IntelliShell

Code for Type Curves (Robo 3T) 

/*
This script will DELETE all type curve models listed below. 
Change "false" below to "true" in order to delete, otherwise it will just count (for safety)
*/
//List all model names, in quotes and separated by commas:
var modelNames = [
    'MyModel1',
    'MyModel2',
]
//////////////////////////////////////////////////////
var I_WOULD_LIKE_TO_DELETE_ALL_MODELS = false;
//////////////////////////////////////////////////////
modelNames.forEach((modelName) => {
    if (I_WOULD_LIKE_TO_DELETE_ALL_MODELS) {
        printjson({
            _id: modelName,
            modelCount: db.getCollection("prod.TypeCurveModels").deleteMany({'modelName': modelName}),
        });
    }
    else {
        printjson({
            _id: modelName,
            modelCount: db.getCollection("prod.TypeCurveModels").count({'modelName': modelName}),
        });
    }
});

Code for Type Curves (Studio 3T)

//Define DB Below
use petroai;
/*
This script will DELETE all type curve models listed below. 
Change "false" below to "true" in order to delete, otherwise it will just count (for safety)
*/
//List all model names, in quotes and separated by commas:
var modelNames = [
    'MyModel1',
    'MyModel2',
]
//////////////////////////////////////////////////////
var I_WOULD_LIKE_TO_DELETE_ALL_MODELS = false;
//////////////////////////////////////////////////////
modelNames.forEach((modelName) => {
    if (I_WOULD_LIKE_TO_DELETE_ALL_MODELS) {
        printjson({
            _id: modelName,
            modelCount: db.getCollection("prod.TypeCurveModels").deleteMany({'modelName': modelName}),
        });
    }
    else {
        printjson({
            _id: modelName,
            modelCount: db.getCollection("prod.TypeCurveModels").count({'modelName': modelName}),
        });
    }
});

Examples:

Robo 3T

 

Studio 3T – IntelliShell

Enjoy!

Stay tuned for the next blog where I will talk about how to rename your model.

Leave a Reply

Your email address will not be published. Required fields are marked *