基于VBA的石油地质数据处理

2018-10-25 11:06:56陈蜀曹剑利
计算机时代 2018年9期

陈蜀 曹剑利

摘 要: 海量数据处理是石油地质项目开展过程中的重要工作,若依靠纯手工处理工作量巨大。文章提出了基于VBA数据批量处理方法,以气藏数值模拟工艺改造数据的处理为例,在EXCEL中运用VBA进行编程,实现海量射孔數据的提取与标准化处理。首先从井史数据出发,借助文件对象打开对应井单的射孔数据文件,然后循环提取射孔数据中的相关数据信息,进行标准化处理后写入工艺改造数据表格中,生成气藏数值模拟的基础数据体。针对示范工区数据处理表明,该方法不但极大地提高了气藏数值模拟基础数据的整理效率,同时也能克服人工处理因疲劳导致的错误,提高了数据处理的质量。

关键词: VBA; EXCEL; 海量数据; 批处理

中图分类号:TP399 文献标志码:A 文章编号:1006-8228(2018)09-48-03

Abstract: Massive data processing is often faced in the process of petroleum geological projects, and it is hard by manual process. This paper proposes a data batch processing method via VBA. Taking the data processing of numerical simulation process for gas reservoir as an example, the Excel spreadsheet is used with VBA programming to realize the massive perforation data extraction and standardized processing. Firstly, from well history data, opening the perforation data file of the corresponding well sheet with the help of the file object, then circularly extracting relevant data information from perforation data and writing into the data form of process modification after standardized processing, at last generating the basic data volume for numerical simulation of gas reservoir. Data processing for demonstration area shows that this method not only greatly improves the efficiency of sorting out the basic data of gas reservoir numerical simulation but also overcomes the errors caused by fatigue and improves the quality of data processing.

Key words: VBA; Excel; massive data; batch processing

0 引言

虽然Excel功能强大且提供了丰富的函数辅助数据处理,但仍然不能满足一些特殊数据的处理要求。为了处理一些模型更为复杂的数据,我们可以利用Excel自带的开发环境VBA实现数据处理在某些方面的特殊要求[1-2]。例如:Dydowicz, P.基于VBA对海量公司数据进行了批量格式转换[3]。DJ Zhang利用Excel VBA进行本地奇点分析批量运算[4]。在Excel中,处理少量数据的时候可以人工操作处理,当数据处理需要不断重复相同的操作时,可以用Excel中的录制宏来操作,而当我们处理繁琐并且重复量很大的数据时,VBA的编写就可以帮助减少大量重复的工作。VBA属于面向对象的编程语言,具有易理解、语法简单的特点,加之,VBA是针对某个特定程序开发,利用简单的代码即可完成复杂的功能[5-6]。……

登录APP查看全文