




版權說明:本文檔由用戶提供并上傳,收益歸屬內容提供方,若內容存在侵權,請進行舉報或認領
文檔簡介
1/23第1章WIS測井數據文件格式曲線),表對象用來存放二維表數據(如解釋結論),流對象用來存放二進制數據塊(如解釋參數,用戶數據)。{2/23}WIS_HEAD;0246822224444當前記錄的對象總數(包括刪除和拋棄的對象)。typedefstructtagWIS_OBJECT_ENTRY{3/23}WIS_OBJECT_ENTRY;偏移字節數描述。對象數據體記錄各個對象的具體特性及數據。根據不同的主屬性分三維信非等間隔(離散)。最大允許有四維信息,通道信息構定義如下:typedefstructtagWIS_CHANNLE{4/23floatMinVal;floatMaxVal;}WIS_CHANNEL;08串。8224對象的最小值(測井曲線缺省左刻度值)。4對象的最大值(測井曲線缺省右刻度值)。22typedefstructtagWIS_CHANNLE_DIMENSION{charUnit8];}WIS_CHANNEL_DIMENSION;5/2308884444422散數據,該變采樣點)時有效,該[A1]+[N2]+[B1]+X1+[B2]+X2+···+[BN]+XN+[A2]+[N2]+[B1]+X1+[B2]+X2+···+[BN]+XN+[AN]+[N2]+[B1]+X1+[B2]+X2+···+[BN]+XNN構6/23表對象用來存放二維表數據,分為表信息和表數據體兩個部分。表信組成,每一表項稱為字段。表信息結構定義如下:typedefstructtagWIS_TABLE{}WIS_TABLE;048444typedefstructtagWIS_TABLE_FIELD{}WIS_TABLE_FIELD;22字段值的浮點類型,參見3.2.1。7/23流對象用來存放二進制數據塊。開始為4個字節的無符號長整形數,代表數據流的長度。接著為該流的二進制值。第二章WIS測井數據格式轉換文本格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-通道對象2-表對象3-流對象象54.DWORDPosition;//對象數據體從文件開始處的偏移量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./*曲線的信息結構體*/135.typedefstructtagCURVE_HEAD136.{137.charName[16];//曲線的名字138.charUnit[8];//曲線的單位139.floatstartMD;//曲線的起始深度140.floatstopMD;//曲線的結束深度141.intpointNum;//數據樣點數142.intposition;//數據位置143.structtagCURVE_HEAD*next;144.}CURVE_HEAD;/*曲線的數據結構體*/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("文件標識符:%s/n",wisid);198.fprintf(txtfile,"ASCIIWIS%c%c%c/n",wisid[4],wisid[5],wisid[6]);200./**頭文件緊接文件標識*/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("對象入口記錄從文件開始的偏移量EntryOffset:%d/n",wishead->EntryOffset);206.//printf("對象數據記錄從文件開始的偏移量DataOffset:%d/n",wishead->DataOffset);207.//printf("當前記錄的對象總數ObjectNumber:%d/n",wishead->ObjectNumber);08.09.et211./**curvePosition數組保存曲線數據開始的位/**curveName數組保存每條曲線的名稱*//**curveNum變量文件中保存曲線的數目*/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("曲線對象的名稱Name:%s/n",objectEntry->Name);234.//fprintf(outfile,"%s",objectEntry->Name);//打印曲線名字235.//printf("對象數據體絕對偏移量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文件的曲線數目:%d/n/n",in,curveNum);55./********************************************************************/256./*Belowblockreadeverycurveheadinformationandputitinalink*/257./********************************************************************/58.15/23/**創建鏈表data_node開始讀取數據*/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相當于第幾條曲線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("對象的單位Unit:%s/n",channel->Unit);277.//printf("對象的別名AliasName:%s/n",channel->AliasName);278.//printf("單位的別稱AliasUnit:%s/n",channel->AliasUnit);279.//printf("對象的最小值MinVal:%f/n",channel->MinVal);280.//printf("對象的最大值MaxVal:%f/n",channel->MaxVal);281.//printf("對象維信息數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;//深度采樣點的個數286.data_head->startMD=channel->DimInfo[0].StartVal;//起始深度287.delta=channel->DimInfo[0].Delta;//間隔點值288.data_head->stopMD=channel->DimInfo[0].StartVal+delta*channel->DimInfo[0].MaxSamples;//結束深度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);//曲線編號302.printf("%s/t",data_head->Name);//曲線名303.printf("%s/t",data_head->Unit);//曲線單位304.printf("%d/t",data_head->pointNum);//采樣點數305.printf("%9.3f/t",delta);//采樣點間隔306.printf("%9.3f/t",data_head->startMD);//起始深度307.printf("%9.3f/n",data_head->stopMD);//結束深度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.//利用最小最大深度值和間隔點值,確定輸出的采樣點數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.//從這里開始將數據值放入曲線各自對應的鏈表里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("測試樣點數%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. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯系上傳者。文件的所有權益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網頁內容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
- 4. 未經權益所有人同意不得將文件中的內容挪作商業或盈利用途。
- 5. 人人文庫網僅提供信息存儲空間,僅對用戶上傳內容的表現方式做保護處理,對用戶上傳分享的文檔內容本身不做任何修改或編輯,并不能對任何下載內容負責。
- 6. 下載文件中如有侵權或不適當內容,請與我們聯系,我們立即糾正。
- 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 互聯網行業分享
- 公司顧問聘用合同范例二零二五年
- 二零二五版醫院員工聘用合同樣本
- 員工試用期協議書二零二五年
- 沿街商鋪出租協議范例二零二五年
- (福建專用)中考歷史真題匯編:綜合材料題- 5年(2020-2024)中考真題+1年模擬真題匯編
- (黑龍江專用)中考歷史真題匯編:綜合材料題- 5年(2020-2024)中考真題+1年模擬真題匯編
- 財務管理與校園貸
- 車間降溫冰塊管理制度
- 銷售簽單閉環管理制度
- 2024年消防宣傳月知識競賽考試題庫300題(含答案)
- 道路旅客運輸企業雙重預防機制建設指導手冊
- 歷史的三峽:近代中國思潮與政治學習通超星期末考試答案章節答案2024年
- 掛靠租車合同范本
- 2024年中國壁球館市場調查研究報告
- 水楊酸產品原材料供應與需求分析
- 地下車庫等環氧地坪漆工程投標文件(技術標)
- XXX小學“三會一課”活動記錄
- 成人重癥患者人工氣道濕化護理專家共識 解讀
- 1《諫太宗十思疏》公開課一等獎創新教學設計統編版高中語文必修下冊
- 2024年湖北省中考地理生物試卷(含答案)
評論
0/150
提交評論