WIS測(cè)井?dāng)?shù)據(jù)格式_第1頁(yè)
WIS測(cè)井?dāng)?shù)據(jù)格式_第2頁(yè)
WIS測(cè)井?dāng)?shù)據(jù)格式_第3頁(yè)
WIS測(cè)井?dāng)?shù)據(jù)格式_第4頁(yè)
WIS測(cè)井?dāng)?shù)據(jù)格式_第5頁(yè)
已閱讀5頁(yè),還剩26頁(yè)未讀, 繼續(xù)免費(fèi)閱讀

下載本文檔

版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)

文檔簡(jiǎn)介

1/23第1章WIS測(cè)井?dāng)?shù)據(jù)文件格式曲線),表對(duì)象用來(lái)存放二維表數(shù)據(jù)(如解釋結(jié)論),流對(duì)象用來(lái)存放二進(jìn)制數(shù)據(jù)塊(如解釋參數(shù),用戶數(shù)據(jù))。{2/23}WIS_HEAD;0246822224444當(dāng)前記錄的對(duì)象總數(shù)(包括刪除和拋棄的對(duì)象)。typedefstructtagWIS_OBJECT_ENTRY{3/23}WIS_OBJECT_ENTRY;偏移字節(jié)數(shù)描述。對(duì)象數(shù)據(jù)體記錄各個(gè)對(duì)象的具體特性及數(shù)據(jù)。根據(jù)不同的主屬性分三維信非等間隔(離散)。最大允許有四維信息,通道信息構(gòu)定義如下:typedefstructtagWIS_CHANNLE{4/23floatMinVal;floatMaxVal;}WIS_CHANNEL;08串。8224對(duì)象的最小值(測(cè)井曲線缺省左刻度值)。4對(duì)象的最大值(測(cè)井曲線缺省右刻度值)。22typedefstructtagWIS_CHANNLE_DIMENSION{charUnit8];}WIS_CHANNEL_DIMENSION;5/2308884444422散數(shù)據(jù),該變采樣點(diǎn))時(shí)有效,該[A1]+[N2]+[B1]+X1+[B2]+X2+···+[BN]+XN+[A2]+[N2]+[B1]+X1+[B2]+X2+···+[BN]+XN+[AN]+[N2]+[B1]+X1+[B2]+X2+···+[BN]+XNN構(gòu)6/23表對(duì)象用來(lái)存放二維表數(shù)據(jù),分為表信息和表數(shù)據(jù)體兩個(gè)部分。表信組成,每一表項(xiàng)稱為字段。表信息結(jié)構(gòu)定義如下:typedefstructtagWIS_TABLE{}WIS_TABLE;048444typedefstructtagWIS_TABLE_FIELD{}WIS_TABLE_FIELD;22字段值的浮點(diǎn)類型,參見3.2.1。7/23流對(duì)象用來(lái)存放二進(jìn)制數(shù)據(jù)塊。開始為4個(gè)字節(jié)的無(wú)符號(hào)長(zhǎng)整形數(shù),代表數(shù)據(jù)流的長(zhǎng)度。接著為該流的二進(jìn)制值。第二章WIS測(cè)井?dāng)?shù)據(jù)格式轉(zhuǎn)換文本格viewplaincopytoclipboardprint?1./*2.*Copyright(c)2011,SunYunqiang3.*Allrightsreserved.4.*Software:wis2txt_win5.*Version:1.06.*Author:SunYunqiang7.*EnglishName:AlexSun8.*ReleaseDate:18/03/20119.*/11./********************************************************************/12./**ThisProgramisforconvertingwisformattxtformatfile*//**Description:115./**wis2txt_win.exe:theexecutablecommand*/16./**args1:thefirstargumentthatisthewis*/17./**args2:thesecondargumentthatisthetxt*/18./********************************************************************/20.#include<windows.h>8/2321.#include<stdio.h>22.#include<stdlib.h>23.#include<string.h>24.#include<ctype.h>25.#include<time.h>26.#include<math.h>27.28.#defineROW6553629.#defineCOL51230.31.32./******************************************/33./*Belowblocksarethestructsofwisfile*/34./******************************************/35.typedefstructtagWIS_HEAD36.{37.WORDMachineType;//0-PC1-SUN2-IBM3-HP38.WORDMaxObjectNumber;39.WORDObjectNumber;40.WORDBlockLen;41.DWORDEntryOffset;42.DWORDDataOffset;43.DWORD;44.time_tTimeCreate;45.charReserved[32];46.}WIS_HEAD;47.48.typedefstructtagWIS_OBJECT_ENTRY49.{50.charName[16];51.longStatus;shortAttribute;//1-通道對(duì)象2-表對(duì)象3-流對(duì)象象54.DWORDPosition;//對(duì)象數(shù)據(jù)體從文件開始處的偏移量55.DWORDBlockNum;56.time_tTimeCreate;57.time_tTimeWrite;58.charReserved[32];59.}WIS_OBJECT_ENTRY;0.61.typedefstructtagWIS_CHANNEL_DIMENSION62.{63.charName[8];64.charUnit[8];65.charAliasName[16];66.floatStartVal;67.floatDelta;68.DWORDSamples;69.DWORDMaxSamples;70.DWORDSize;71.WORDRepCode;72.WORDReserved;73.}WIS_CHANNEL_DIMENSION;4.75.typedefstructtagWIS_CHANNEL76.{77.charUnit[8];78.charAliasName[16];79.charAliasUnit[16];80.WORDRepCode;81.WORDCodeLen;82.floatMinVal;83.floatMaxVal;84.WORDReserved;85.WORDNumOfDimension;86.WIS_CHANNEL_DIMENSIONDimInfo[4];87.}WIS_CHANNEL;88.89.typedefstructtagWIS_STREAM9/2390.{91.DWORDLength;92.DWORDOffset;93.}WIS_STREAM;94.95.typedefstructtagWIS_TABLE_FIELD96.{97.charName[32];98.WORDRepCode;99.WORDLength;100.DWORDReserved;101.}WIS_TABLE_FIELD;103.typedefstructtagWIS_TABLE104.{105.DWORDRecordCount;106.DWORDFieldCount;107.WIS_TABLE_FIELD*pField;108.}WIS_TABLE;111.typedefstructtagWIS_TABLE_DEFAULT_FILED112.{113.charName[16];114.charAlias[16];115.charUnit[8];116.charType[8];117.WORDLength;118.WORDCount;119.charDefVal[64][12];120.}WIS_TABLE_DEFAULT_FIELD;123.typedefstructtagWIS_DEFAULT_TABLE124.{10/2311/23125.charName[16];126.charAlias[16];127.charAttrb[8];128.DWORDFieldCount;129.WIS_TABLE_DEFAULT_FIELD*pField;130.}WIS_DEFAULT_TABLE;134./*曲線的信息結(jié)構(gòu)體*/135.typedefstructtagCURVE_HEAD136.{137.charName[16];//曲線的名字138.charUnit[8];//曲線的單位139.floatstartMD;//曲線的起始深度140.floatstopMD;//曲線的結(jié)束深度141.intpointNum;//數(shù)據(jù)樣點(diǎn)數(shù)142.intposition;//數(shù)據(jù)位置143.structtagCURVE_HEAD*next;144.}CURVE_HEAD;/*曲線的數(shù)據(jù)結(jié)構(gòu)體*/147.typedefstructtagCURVE_DATA148.{149.charName[16];//曲線的名字150.charUnit[8];//曲線的單位151.floatDepth[ROW];//曲線的深度值152.floatValue[ROW];//曲線的值153.structtagCURVE_DATA*next;154.}CURVE_DATA;159./***************************************************************/12/23160./*BelowblockistheMainprogramofprocessingwisformatfile*/161./***************************************************************/163.intmain(intargc,char*argv[])164.{165.FILE*wisfile;//輸入文件166.FILE*txtfile;//輸出文件167.char*in=argv[1];168.char*out=argv[2];169.//char*in="demoa.wis";170.//char*out="demoa.txt";172.if(argc!=3)173.{174.printf("ERROR:Commandparametersisnotdefinedcorrectly!/n");175.exit(1);176.}179.wisfile=fopen(in,"rb");180.if(wisNULL)181.{182.printf("ERROR:Read");183.exit(1);184.}185.txtfile=fopen(out,"w");186.if(txtNULL)187.{188.printf("ERROR:Write");189.exit(1);190.}192./*Processwisfile,Readitandtransferittotext*/s13/23195.charwisid[10];196.fread(wisid,10,1,wisfile);197.//printf("文件標(biāo)識(shí)符:%s/n",wisid);198.fprintf(txtfile,"ASCIIWIS%c%c%c/n",wisid[4],wisid[5],wisid[6]);200./**頭文件緊接文件標(biāo)識(shí)*/201.WIS_HEAD*wishead;202.wishead=(WIS_HEAD*)malloc(sizeof(WIS_HEAD));203.fseek(wisfile,10,SEEK_SET);204.fread(wishead,sizeof(WIS_HEAD),1,wisfile);205.//printf("對(duì)象入口記錄從文件開始的偏移量EntryOffset:%d/n",wishead->EntryOffset);206.//printf("對(duì)象數(shù)據(jù)記錄從文件開始的偏移量DataOffset:%d/n",wishead->DataOffset);207.//printf("當(dāng)前記錄的對(duì)象總數(shù)ObjectNumber:%d/n",wishead->ObjectNumber);08.09.et211./**curvePosition數(shù)組保存曲線數(shù)據(jù)開始的位/**curveName數(shù)組保存每條曲線的名稱*//**curveNum變量文件中保存曲線的數(shù)目*/214.intcurvePosition[512];215.intcurveName[512][16];216.intcurveNum=0;//curveNumistheidentiferofthecurvesnumber217.fseek(wisfile,wishead->EntryOffset,SEEK_SET);218.//fseek(wisfile,10+sizeof(WIS_HEAD),SEEK_SET);219.while(1)220.{221.WIS_OBJECT_ENTRY*objectEntry;222.objectEntry=(WIS_OBJECT_ENTRY*)malloc(sizeof(WIS_OBJECT_NTRY223.fread(objectEntry,sizeof(WIS_OBJECT_ENTRY),1,wisfile);24.14/23225.if(objectEntry->Attribute==0)226.{227.break;228.}229.elseif(objectEntry->Attribute==1)230.{231.//printf("通道類型:%d/n",objectEntry->Attribute);232.//printf("No.%d/n",curveNum);233.//printf("曲線對(duì)象的名稱Name:%s/n",objectEntry->Name);234.//fprintf(outfile,"%s",objectEntry->Name);//打印曲線名字235.//printf("對(duì)象數(shù)據(jù)體絕對(duì)偏移量Position:%d/n/n",objectEntry->Position);236.curvePosition[curveNum]=objectEntry->Position;237.inti=0;238.for(i=0;i<16;i++)239.{240.curveName[curveNum][i]=objectEntry->Name[i];241.}42.243.curveNum++;244.}245.else246.{247.continue;248.}49.250.}251.printf("/n%s文件的曲線數(shù)目:%d/n/n",in,curveNum);55./********************************************************************/256./*Belowblockreadeverycurveheadinformationandputitinalink*/257./********************************************************************/58.15/23/**創(chuàng)建鏈表data_node開始讀取數(shù)據(jù)*/261.CURVE_HEAD*first_head=NULL;262.floatdelta=0.0;63.264.CURVE_HEAD*data_head=NULL;265.intnum=0;266.for(num=0;num<curveNum;num++)//num相當(dāng)于第幾條曲線267.{68.269.data_head=(CURVE_HEAD*)malloc(sizeof(CURVE_HEAD));270.data_head->position=curvePosition[num];71.272.fseek(wisfile,curvePosition[num],SEEK_SET);273.WIS_CHANNEL*channel;274.channel=(WIS_CHANNEL*)malloc(sizeof(WIS_CHANNEL));275.fread(channel,sizeof(WIS_CHANNEL),1,wisfile);276.//printf("對(duì)象的單位Unit:%s/n",channel->Unit);277.//printf("對(duì)象的別名AliasName:%s/n",channel->AliasName);278.//printf("單位的別稱AliasUnit:%s/n",channel->AliasUnit);279.//printf("對(duì)象的最小值MinVal:%f/n",channel->MinVal);280.//printf("對(duì)象的最大值MaxVal:%f/n",channel->MaxVal);281.//printf("對(duì)象維信息數(shù)NumOfDimension:%d/n",channel->NumOfDimension);282.//printf("維的開始值StartVal:%f/n",channel->DimInfo[0].StartVal);283.//printf("維的增量值Delta:%f/n",channel->DimInfo[0].Delta);84.285.data_head->pointNum=channel->DimInfo[0].MaxSamples;//深度采樣點(diǎn)的個(gè)數(shù)286.data_head->startMD=channel->DimInfo[0].StartVal;//起始深度287.delta=channel->DimInfo[0].Delta;//間隔點(diǎn)值288.data_head->stopMD=channel->DimInfo[0].StartVal+delta*channel->DimInfo[0].MaxSamples;//結(jié)束深度89.90.16/23291.inti=0;292.for(i=0;i<16;i++)293.{294.data_head->Name[i]=curveName[num][i];295.}296.for(i=0;i<8;i++)297.{298.data_head->Unit[i]=channel->Unit[i];299.}00.301.printf("No.%d/t",num+1);//曲線編號(hào)302.printf("%s/t",data_head->Name);//曲線名303.printf("%s/t",data_head->Unit);//曲線單位304.printf("%d/t",data_head->pointNum);//采樣點(diǎn)數(shù)305.printf("%9.3f/t",delta);//采樣點(diǎn)間隔306.printf("%9.3f/t",data_head->startMD);//起始深度307.printf("%9.3f/n",data_head->stopMD);//結(jié)束深度08.09.10.311.data_head->next=first_head;312.first_head=data_head;313.}17./*************************************************************************/318./*BelowblockisfordecidingtheminandmaxDepth,andthemaxlinenum319./*************************************************************************/20.321.//從這里開始判斷所有曲線中最小深度和最大深度值322.floatminDepth=0.0;323.floatmaxDepth=0.0;324.minDepth=first_head->startMD;17/23325.maxDepth=first_head->stopMD;326.for(data_head=first_head;data_head!=NULL;data_head=data_head->327.{328.if(minDepth>data_head->startMD)329.{330.minDepth=data_head->startMD;331.}332.if(maxDepth<data_head->stopMD)333.{334.maxDepth=data_head->stopMD;335.}336.}intffnminDepthprintffnmaxDepth);39.340.//利用最小最大深度值和間隔點(diǎn)值,確定輸出的采樣點(diǎn)數(shù)341.floatdepth[ROW];342.intlineNum=0;343.lineNum=(maxDepth-minDepth)/delta;ntfdnlineNrow=0;347.for(row=0;row<lineNum;row++)348.{349.depth[row]=minDepth+delta*row;350.}54./**********************************************************/355./*Belowblockputeverypointvalueintoalinkasacurve*/356./**********************************************************/57.358.//從這里開始將數(shù)據(jù)值放入曲線各自對(duì)應(yīng)的鏈表里18/2359.360.CURVE_DATA*first_node=NULL;361.CURVE_DATA*data_node=NULL;62.363.data_head=first_head;64.365.for(num=0;num<curveNum;num++)366.{367.data_node=(CURVE_DATA*)malloc(sizeof(CURVE_DATA));368.inti=0;369.for(i=0;i<16;i++)370.{371.data_node->Name[i]=data_head->Name[i];372.}373.for(i=0;i<8;i++)374.{375.data_node->Unit[i]=data_head->Unit[i];376.}//printf("曲線名稱:%s/n",data_node->Name);//printf("曲線單位:%s/n",data_node->Unit);79.380.intstartLine=0;381.for(row=0;row<lineNum;row++)382.{383.if(abs(depth[row]-data_head->startMD)<=delta384.&&depth[row]>=data_head->startMD)385.{386.startLine=row;387.break;388.}389.}ntfdnstartLine91.392.//fseek(wisfile,data_head->position,SEEK_SET);19/23393.fseek(wisfile,data_head->position+2*sizeof(WIS_CHANNEL)+464,SEEKSET94.395.//printf("測(cè)試樣點(diǎn)數(shù)%d/n",data_head->pointNum);396.for(row=0;row<lineNum;row++)397.{398.floatdata[1];399.data[0]=-9999.000;400.if(row>=startLine&&(row-startLine)<data_head->pointNum)401.{402.fread(data,sizeof(float),1,wisfile);403.data_node->Depth[row]=data_head->startMD+delta*(row-startLine);404.data_node->Value[row]=data[0];405.}406.else407.{408.data_node->Depth[row]=minDepth+delta*row;409.data_node->Value[row]=-9999.000;410.}411.412.//printf("讀取值:%f/n",data_node->Value[row]);413.}414.415.416.data_node->next=first_node;417.first_node=data_node;418.if(data_head->next==NULL)419.{420.break;421.}422.423.data_head=data_head->next;424.//printf("下一條曲線名:%s/n",data_head->Name);425.}20/23426.427.428./******************************************************/429./*Belowblockprintallpointvalueforeverycurve*/430./*Theimportantthingishowtodecidetherightdepth*/431./******************************************************/432.433.//從這里開始寫入文本434.435.//PrintCurveName436.fprintf(txtfile,"DEPTH");437.for(data_node=first_node;data_node!=NULL;data_node=data_node->n438.{439.fprintf(txtfile,"%9s",data_node->Name);440.}441.fprintf(txtfile,"/n");442.//printf("/n");443.444.//PrintCurveUnit445.

溫馨提示

  • 1. 本站所有資源如無(wú)特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫(kù)網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。

最新文檔

評(píng)論

0/150

提交評(píng)論