亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? segyread.c

?? 這是一個讀SEGY文件的源碼
?? C
?? 第 1 頁 / 共 2 頁
字號:
/* Copyright (c) Colorado School of Mines, 2007.*//* All rights reserved.                       *//* SEGYREAD: $Revision: 1.63 $ ; $Date: 2006/10/31 22:25:37 $     */#include "su.h"#include "segy.h"#include "tapesegy.h"#include "tapebhdr.h"#include "bheader.h"#include "header.h"/*********************** self documentation **********************/char *sdoc[] = {"									"," SEGYREAD - read an SEG-Y tape						","									","   segyread > stdout tape=						","									","   or									","									","   SEG-Y data stream ... | segyread tape=-  > stdout			","									"," Required parameter:							"," tape=		input tape device or seg-y filename (see notes)		","									"," Optional parameters:							"," buff=1	for buffered device (9-track reel tape drive)		","		=0 possibly useful for 8mm EXABYTE drives		"," verbose=0	silent operation					","		=1 ; echo every 'vblock' traces				"," vblock=50	echo every 'vblock' traces under verbose option		"," hfile=header	file to store ebcdic block (as ascii)			"," bfile=binary	file to store binary block				"," over=0		quit if bhed format not equal 1, 2, 3, 5, or 8		","		= 1 ; override and attempt conversion			"," format=bh.format	if over=1 try to convert assuming format value  "," conv=1	convert data to native format				","			= 0 ; assume data is in native format		"," ns=bh.hns	number of samples (use if bhed ns wrong)		"," trcwt=1	apply trace weighting factor (bytes 169-170)		","		=0, do not apply.  (Default is 0 for formats 1 and 5)	"," trmin=1		first trace to read				"," trmax=INT_MAX	last trace to read					"," endian=1	set =0 for little-endian machines(PC's,DEC,etc.)	"," errmax=0	allowable number of consecutive tape IO errors		"," remap=...,...	remap key(s) 						"," byte=...,...	formats to use for header remapping 			"," 									"," Notes:								"," Traditionally tape=/dev/rmt0.	 However, in the modern world tape device"," names are much less uniform.  The magic name can often be deduced by	"," \"ls /dev\".  Likely man pages with the names of the tape devices are:"," \"mt\", \"sd\" \"st\".  Also try \"man -k scsi\", \" man mt\", etc.	"," Sometimes \"mt status\" will tell the device name.			"," 									"," For a SEG-Y diskfile use tape=filename.				"," 									"," Remark: a SEG-Y file is not the same as an su file. A SEG-Y file	"," consists of three parts: an ebcdic header, a binary reel header, and	"," the traces.  The traces are (usually) in 32 bit IBM floating point	"," format.  An SU file consists only of the trace portion written in the "," native binary floats.							","									"," Formats supported:							"," 1: IBM floating point, 4 byte (32 bits)				"," 2: two's complement integer, 4 byte (32 bits)				"," 3: two's complement integer, 2 byte (16 bits)				"," 5: IEEE floating point, 4 byte (32 bits)				"," 8: two's complement integer, 1 byte (8 bits)				","									"," tape=-   read from standard input. Caveat, under Solaris, you will	"," need to use the buff=1 option, as well.				","									"," Header remap:								"," The value of header word remap is mapped from the values of byte	","									"," Map a float at location 221 to sample spacing d1:			","	segyread <data >outdata remap=d1 byte=221f			","									"," Map a long at location 225 to source location sx:			","	segyread <data >outdata remap=sx byte=225l			","									"," Map a short at location 229 to gain constant igc:			","	segyread <data >outdata remap=igc byte=229s			","									"," Or all combined: 							","	segyread <data >outdata remap=d1,sx,igc byte=221f,225l,229s	","									"," Segy header words are accessed as Xt where X denotes the byte number	"," starting at 1 in correspondance with the SEGY standard (1975)		"," Known types include:	f	float (4 bytes)				"," 			l	long int (4 bytes)			"," 			s	short int (2 bytes)			"," 			b	byte (1 bytes)				","									","	  type:	  sudoc segyread   for further information		","									",NULL};/* * Note: *      If you have a tape with multiple sequences of ebcdic header, *	binary header,traces, use the device that *	invokes the no-rewind option and issue multiple segyread *	commands (making an appropriate shell script if you *	want to save all the headers).	Consider using >> if *	you want a single trace file in the end.  Similar *	considerations apply for multiple reels of tapes, *	but use the standard rewind on end of file. *						 * Note: For buff=1 (default) tape is accessed with 'read', for buff=0 *	tape is accessed with fread. We suggest that you try buff=1 *	even with EXABYTE tapes.				  * Caveat: may be slow on an 8mm streaming (EXABYTE) tapedrive * Warning: segyread or segywrite to 8mm tape is fragile. Allow sufficient *	time between successive reads and writes. * Warning: may return the error message "efclose: fclose failed" *	intermittently when segyreading/segywriting to 8mm (EXABYTE) tape *	even if actual segyread/segywrite is successful. However, this *	error message may be returned if your tape drive has a fixed  *	block size set. * Caution: When reading or writing SEG-Y tapes, the tape *	drive should be set to be able to read variable block length *	tape files. *//* Credits: *	SEP: Einar Kjartansson *	CWP: Jack K. Cohen, Brian Sumner, Chris Liner *	   : John Stockwell (added 8mm tape stuff) * conv parameter added by: *	Tony Kocurko *	Department of Earth Sciences *	Memorial University of Newfoundland *	St. John's, Newfoundland * read from stdin via tape=-  added by	Tony Kocurko * bhed format = 2,3 conversion by: *	Remco Romijn (Applied Geophysics, TU Delft) *	J.W. de Bruijn (Applied Geophysics, TU Delft) * bhed format = 8 conversion by: John Stockwell * header remap feature added by: * 	Matthias Imhof, Virginia Tech *-------------------------- * Additional Notes: *	Brian's subroutine, ibm_to_float, which converts IBM floating *	point to IEEE floating point is NOT portable and must be *	altered for non-IEEE machines.	See the subroutine notes below. * *	A direct read by dd would suck up the entire tape; hence the *	dancing around with buffers and files. *  *//**************** end self doc ***********************************//* Subroutine prototypes */static void ibm_to_float(int from[], int to[], int n, int endian);static void long_to_float(long from[], float to[], int n, int endian);static void short_to_float(short from[], float to[], int n, int endian);static void integer1_to_float(signed char from[], float to[], int n);static void tapebhed_to_bhed(const tapebhed *tapebhptr, bhed *bhptr);static void tapesegy_to_segy(const tapesegy *tapetrptr, segy *trptr);static	void ugethval(cwp_String type1, Value *valp1, 	       char type2, int ubyte, 	       char *tr, int endian, int conv);/* Globals */tapesegy tapetr;tapebhed tapebh;segy tr;bhed bh;intmain(int argc, char **argv){	char *tape;		/* name of raw tape device	*/	char *bfile;		/* name of binary header file	*/	char *hfile;		/* name of ascii header file	*/	int tapefd=0;		/* file descriptor for tape	*/	FILE *tapefp=NULL;	/* file pointer for tape	*/	FILE *binaryfp;		/* file pointer for bfile	*/	FILE *headerfp;		/* file pointer for hfile	*/	FILE *pipefp;		/* file pointer for popen write */	size_t nsegy;		/* size of whole trace in bytes		*/	int i;			/* counter				*/	int itr;		/* current trace number			*/	int trmin;		/* first trace to read			*/	int trmax;		/* last trace to read			*/	int ns;			/* number of data samples		*/	int over;		/* flag for bhed.float override		*/	int format;		/* flag for to specify override format	*/	cwp_Bool format_set = cwp_false;				/* flag to see if new format is set	*/	int conv;		/* flag for data conversion		*/	int trcwt;		/* flag for trace weighting		*/	int verbose;		/* echo every ...			*/	int vblock;		/* ... vblock traces with verbose=1	*/	int buff;		/* flag for buffered/unbuffered device	*/	int endian;		/* flag for big=1 or little=0 endian	*/	int errmax;		/* max consecutive tape io errors	*/	int errcount = 0;	/* counter for tape io errors		*/	cwp_Bool nsflag;	/* flag for error in tr.ns		*/ 	char cmdbuf[BUFSIZ];	/* dd command buffer			*/	char ebcbuf[EBCBYTES];	/* ebcdic data buffer			*/	cwp_String key1[SU_NKEYS];	/* output key(s)		*/	cwp_String key2[SU_NKEYS];	/* first input key(s)		*/	cwp_String type1[SU_NKEYS];	/* array of types for key1	*/	char type2[SU_NKEYS];		/* array of types for key2	*/	int ubyte[SU_NKEYS];	int nkeys;			/* number of keys to be computed*/	int n;				/* counter of keys getparred	*/	int ikey;			/* loop counter of keys 	*/	int index1[SU_NKEYS];		/* array of indexes for key1 	*/	Value val1;			/* value of key1		*/	/* Initialize */	initargs(argc, argv);	requestdoc(0); /* stdin not used */	/* Make sure stdout is a file or pipe */	switch(filestat(STDOUT)) {	case TTY:		err("stdout can't be tty");	break;	case DIRECTORY:		err("stdout must be a file, not a directory");	break;	case BADFILETYPE:		err("stdout is illegal filetype");	break;	default: /* Others OK */	break;	}	/* Set filenames */	MUSTGETPARSTRING("tape",  &tape);	if (!getparstring("hfile", &hfile))	hfile = "header";	if (!getparstring("bfile", &bfile))	bfile = "binary";		/* Set parameters */	if (!getparint("trmin", &trmin))	trmin = 1;	if (!getparint("trmax", &trmax))	trmax = INT_MAX;	if (!getparint("verbose", &verbose))	verbose = 0;	if (!getparint("vblock", &vblock))	vblock = 50;	if (!getparint("endian", &endian))	endian = 1;	if (!getparint("errmax", &errmax))	errmax = 0;	if (!getparint("buff", &buff))		buff = 1;	/* Override binary format value */	if (!getparint("over", &over))		over = 0;	if (getparint("format", &format))	format_set = cwp_true;	if (((over!=0) && (format_set))) {		bh.format = format;		if ( !(			   (format==1)			|| (format==2) 			|| (format==3)			|| (format==5)			|| (format==8)			) ) { 	          warn("Specified format=%d not supported", format);		  warn("Assuming IBM floating point format, instead");		}	}	/* Override conversion of IBM floating point data? */	if (!getparint("conv", &conv))		conv = 1;	/* Get parameters */	/* get key1's */	if ((n=countparval("remap"))!=0){		nkeys=n;		getparstringarray("remap",key1);	} else { /* set default */		nkeys=0;	}	/* get key2's */	if ((n=countparval("byte"))!=0){		if (n!=nkeys)			err("number of byte's and remap's must be equal!");		getparstringarray("byte",key2);	}	for (ikey=0; ikey<nkeys; ++ikey) {					/* get types and index values */		type1[ikey]  = hdtype(key1[ikey]);		index1[ikey] = getindex(key1[ikey]);		}	for (ikey=0; ikey<nkeys; ++ikey) {		#if 0		fprintf(stderr, "%s\t", key2[ikey]);		#endif		if (sscanf(key2[ikey],"%d%c",&ubyte[ikey],&type2[ikey])!=2)			err("user format XXXt");		#if 0		sscanf(key2[ikey],"%d%c",&ubyte[ikey],&type2[ikey]);		fprintf(stderr, "%d\t%c\n", ubyte[ikey], type2[ikey]);		#endif		}	/* Open files - first the tape */	if (buff) {		if ( tape[0] == '-' && tape[1] == '\0' ) tapefd = 0;		else tapefd = eopen(tape, O_RDONLY, 0444);	} else {		if ( tape[0] == '-' && tape[1] == '\0' ) tapefp = stdin;		else tapefp = efopen(tape, "r");	}	/* - the ebcdic header file in ascii */	headerfp = efopen(hfile, "w");	if (verbose) warn("header file opened successfully");	/* - the binary data file */	binaryfp = efopen(bfile, "w");	if (verbose) warn("binary file opened successfully");	/* Read the ebcdic raw bytes from the tape into the buffer */	if (buff) {		if (-1 == (int) read(tapefd, ebcbuf, EBCBYTES)) {			if (verbose)				warn("tape read error on ebcdic header");			if (++errcount > errmax)				err("exceeded maximum io errors");		} else { /* Reset counter on successful tape IO */			errcount = 0;		}	} else {		 (int) fread(ebcbuf, 1, EBCBYTES, tapefp);		 if (ferror(tapefp)) {			if (verbose)				warn("tape read error on ebcdic header");			if (++errcount > errmax)				err("exceeded maximum io errors");			clearerr(tapefp);		} else { /* Reset counter on successful tape IO */			errcount = 0;		}	}	/* Open pipe to use dd to convert ascii to ebcdic */	sprintf(cmdbuf, "dd ibs=3200 of=%s conv=ascii cbs=80 count=1", hfile);	pipefp = epopen(cmdbuf, "w");	/* Write ebcdic stream from buffer into pipe */	efwrite(ebcbuf, EBCBYTES, 1, pipefp);	/* Read binary header from tape to bh structure */	if (buff) {		if (-1 == read(tapefd, (char *) &tapebh, BNYBYTES)) {			if (verbose)				warn("tape read error on binary header");			if (++errcount > errmax)				err("exceeded maximum io errors");		} else { /* Reset counter on successful tape IO */			errcount = 0;		}	} else {		 fread((char *) &tapebh, 1, BNYBYTES, tapefp);		 if (ferror(tapefp)) {			if (verbose)				warn("tape read error on binary header");			if (++errcount > errmax)				err("exceeded maximum io errors");			clearerr(tapefp);		} else { /* Reset counter on successful tape IO */			errcount = 0;		}	}	/* Convert from bytes to ints/shorts */	tapebhed_to_bhed(&tapebh, &bh);	/* if little endian machine, swap bytes in binary header */	if (endian==0) for (i = 0; i < BHED_NKEYS; ++i) swapbhval(&bh,i);	/* Override binary format value */	if (!getparint("over", &over))		over = 0;	if (getparint("format", &format))	format_set = cwp_true;	if (((over!=0) && (format_set)))	bh.format = format;	/* Override application of trace weighting factor? */	/* Default no for floating point formats, yes for integer formats. */	if (!getparint("trcwt",&trcwt))		trcwt = (bh.format==1 || bh.format==5) ? 0 : 1;  	switch (bh.format) {	case 1:		if (verbose) warn("assuming IBM floating point input");		break;	case 2:		if (verbose) warn("assuming 4 byte integer input");		break;	case 3:		if (verbose) warn("assuming 2 byte integer input");		break;	case 5:		if (verbose) warn("assuming IEEE floating point input");		break;	case 8:		if (verbose) warn("assuming 1 byte integer input");		break;	default:		(over) ? warn("ignoring bh.format ... continue") :			err("format not SEGY standard (1, 2, 3, 5, or 8)");	}	/* Compute length of trace (can't use sizeof here!) */	if (!getparint("ns", &ns))  ns = bh.hns; /* let user override */	if (!ns) err("samples/trace not set in binary header");	bh.hns = ns;	switch (bh.format) {	case 8:		nsegy = ns + SEGY_HDRBYTES;		break;	case 3:		nsegy = ns*2 + SEGY_HDRBYTES;		break;	case 1:	case 2:	case 5:	default:		nsegy = ns*4 + SEGY_HDRBYTES;	}	/* Write binary header from bhed structure to binary file */	efwrite( (char *) &bh,1, BNYBYTES, binaryfp);	/* Close binary and header files now to allow pipe into segywrite */	efclose(binaryfp);	if (verbose) warn("binary file closed successfully");	efclose(headerfp);	epclose(pipefp);	if (verbose) warn("header file closed successfully");	/* Read the traces */	nsflag = cwp_false;

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
一区二区三区久久久| 污片在线观看一区二区| 欧美亚洲免费在线一区| 久久草av在线| 一区二区三区成人| www国产精品av| 欧美在线播放高清精品| 国产精品影视天天线| 天天综合色天天综合色h| 国产精品美女www爽爽爽| 日韩亚洲欧美综合| 色女孩综合影院| 成人综合婷婷国产精品久久蜜臀 | 国产一区二区三区免费| 亚洲精品日韩综合观看成人91| 日韩三级电影网址| 欧洲精品一区二区三区在线观看| 国产成人精品亚洲午夜麻豆| 奇米色一区二区三区四区| 亚洲人成7777| 国产精品久久国产精麻豆99网站| 精品少妇一区二区三区| 欧美狂野另类xxxxoooo| 91黄色免费版| 99r国产精品| 国产91清纯白嫩初高中在线观看| 久久精品99国产国产精| 日韩avvvv在线播放| 一区二区三区中文字幕在线观看| 国产精品久久久久久久蜜臀| 久久综合色婷婷| 欧美xfplay| 日韩精品专区在线影院观看| 欧美群妇大交群的观看方式| 欧美丝袜自拍制服另类| 在线免费精品视频| 91在线播放网址| 91丨九色porny丨蝌蚪| 成人免费av在线| 国产v综合v亚洲欧| 国产一区在线观看麻豆| 狠狠狠色丁香婷婷综合久久五月| 婷婷一区二区三区| 亚洲福利视频三区| 午夜精品在线看| 香蕉av福利精品导航| 视频一区视频二区中文| 图片区小说区区亚洲影院| 天天综合色天天综合| 日本成人在线一区| 人人狠狠综合久久亚洲| 免费在线观看一区| 青青国产91久久久久久| 久久爱www久久做| 国产一二精品视频| 国产成a人亚洲精品| www.亚洲激情.com| 一本色道久久综合狠狠躁的推荐| 91精品福利视频| 欧美老女人在线| 337p粉嫩大胆色噜噜噜噜亚洲| 26uuu精品一区二区| 欧美国产综合一区二区| 最好看的中文字幕久久| 一区二区不卡在线播放| 亚洲成人免费视| 久久精品国产一区二区三| 国产二区国产一区在线观看| 色综合久久综合中文综合网| 欧美色图片你懂的| 精品久久一区二区| 国产精品久线观看视频| 亚洲国产精品综合小说图片区| 日韩成人一级片| 国产成a人亚洲| 精品视频色一区| 久久综合九色综合97婷婷| 最近中文字幕一区二区三区| 日本一区中文字幕| 成人动漫一区二区在线| 欧美精品在线视频| 国产清纯在线一区二区www| 亚洲精品乱码久久久久久久久 | 一本到不卡精品视频在线观看| 欧美婷婷六月丁香综合色| 欧美一级欧美三级在线观看| 中文文精品字幕一区二区| 一区二区高清视频在线观看| 国产一区二区福利视频| 色哟哟在线观看一区二区三区| 欧美一级久久久久久久大片| 国产精品久久影院| 麻豆精品在线看| 色屁屁一区二区| 国产偷国产偷亚洲高清人白洁| 一区二区成人在线| 国产激情视频一区二区在线观看 | 国产精品成人免费在线| 日本中文在线一区| 99久久免费精品高清特色大片| 欧美福利视频一区| 亚洲欧美影音先锋| 久久国产欧美日韩精品| 欧美手机在线视频| 国产精品成人一区二区艾草| 老司机免费视频一区二区三区| 在线亚洲+欧美+日本专区| 久久久久久久电影| 全国精品久久少妇| 91电影在线观看| 国产精品久久久久精k8| 韩国女主播一区二区三区| 欧美精品国产精品| 一区二区国产视频| 99re免费视频精品全部| 久久精品人人做| 久久精品国产亚洲高清剧情介绍 | 欧美性做爰猛烈叫床潮| 国产精品久线在线观看| 国产精品 欧美精品| 日韩一级大片在线| 日韩电影免费在线看| 欧美日韩日日骚| 一区二区三区波多野结衣在线观看| 国产成人av电影| 久久久99久久精品欧美| 久久精品国产秦先生| 91精品久久久久久蜜臀| 香蕉影视欧美成人| 欧美精品第1页| 日本中文字幕一区二区视频| 欧美久久一二三四区| 婷婷一区二区三区| 欧美精品123区| 日韩精品一二区| 欧美一区二区在线视频| 日本强好片久久久久久aaa| 欧美日韩一卡二卡三卡| 亚洲一区电影777| 欧美日韩国产色站一区二区三区| 一区二区不卡在线视频 午夜欧美不卡在| 91免费视频网| 亚洲综合视频在线| 欧美在线制服丝袜| 亚洲成人综合在线| 777a∨成人精品桃花网| 美女网站一区二区| 亚洲精品一区二区三区福利| 国产一区二区在线观看免费| 国产欧美日本一区视频| 成人av在线看| 亚洲久本草在线中文字幕| 在线视频一区二区免费| 日日摸夜夜添夜夜添国产精品 | 蜜桃视频一区二区| 欧美mv日韩mv国产网站app| 韩国一区二区三区| 国产精品理论片在线观看| 91在线小视频| 日韩黄色免费电影| 久久亚洲一级片| 成人激情免费网站| 一区二区三区成人| 欧美一级片在线看| 岛国一区二区三区| 一区二区在线观看免费视频播放 | 欧美极品美女视频| 92精品国产成人观看免费| 亚洲va国产va欧美va观看| 91.麻豆视频| 国产福利精品一区| 亚洲一区二区三区中文字幕| 日韩欧美电影在线| 成人毛片视频在线观看| 亚洲一区二区3| 精品国产免费人成在线观看| 成人激情av网| 日本成人在线看| 日本一区二区动态图| 精品视频1区2区| 国产麻豆91精品| 亚洲自拍偷拍麻豆| 欧美精品一区二区三区高清aⅴ| 99国产一区二区三精品乱码| 亚洲成a人片综合在线| 久久五月婷婷丁香社区| 色一情一乱一乱一91av| 免费人成在线不卡| 亚洲美女屁股眼交| 欧美精品一区二区三区蜜桃| 色综合久久久久| 韩日精品视频一区| 亚洲图片欧美视频| 自拍偷拍亚洲激情| 欧美videos中文字幕| 欧美日韩一区二区在线观看视频| 国产精品18久久久久久vr| 亚洲一区免费视频| 亚洲少妇屁股交4| 国产无一区二区|