Package: gdp
gdp: Geophysical Data Processinggdpprovides a set of tools that are available through command-line-interface (CLI) to process and/or convert common geophysical data types.Release notesVersion 0.1.1Only README is updated for this version.Version 0.1.0This version is the first version that is published onPyPIand it includes the following tools:ToolDescriptioncatconcatenate/reformat numerical or non-numerical datauniongenerate the union of input data filesintersectgenerate the intersect of input data filesdifferencegenerate the difference of input data filessplitsplit a concatenated dataset into multiple data filesmincalculate minimum of values in numerical column(s)maxcalculate maximum of values in numerical column(s)sumcalculate summation of values in numerical column(s)meancalculate mean of values in numerical column(s)mediancalculate median of values in numerical column(s)stdcalculate standard deviation of values in numerical column(s)pipoutput points inside/outside a polygon (ray tracing method)griddergridding/interpolation of 2D/map data with Gaussian smoothing appliedmseed2sacconvert mseed to sac. this script also handles data fragmentation issue.sac2datconvert sac to dat (ascii); output format: time, amplitudenc2datconvert nc data to dat/asciiExamplesSome examplegdpcommands are explained below:gdpcatfile*-x12-v534--header2--footer4--fmt.2.4--sort--uniq--noextra-oconcatenated.txtDescription:This command will concatenate files in current directory matching names 'files*'. While reading, 2 header lines and 4 footer lines will be omitted. Positional columns are the first and second columns (-x 1 2), and value/numerical columns are [5 3 4]. Positional columns will be printed in %.2f format, and value columns will be printed in %.4f.	If files have extra (non-numerical) columns other than the first 5 columns,	'--noextra' will cause not printing them. Flag '-o' can be used to set the output file name and if not specified, the results will be printed to standard output.Many of these flags are also common for the following commands.gdpunionfile_1.datfile_2.datfile_3.datDescription:Output union of a set of numerical data files (two or more) while considering positional columns (default=[1 2]) and value columns as [3] (defaults; these could be modified using '-x' '-v' flags).gdpintersectfile_1.datfile_2.datfile_3.datDescription:Output intersect of a set of numerical data files (two or more) considering positional columns	(similar positional columns that could be specified using '-x' flag; the value of the first file will be the output). Note that the first value of the flag '--fmt' will be important here.gdpdifferencefile_1.datfile_2.datfile_3.datDescription:Output difference of a set of numerical data files (two or more) considering positional columns. In this case, data points that are unique to 'file_1.dat' will be the output results.gdpsplitdataset.dat--methodncol--number4--start-2--name3-ooutdirDescription:This command is useful to split/unmerge a concatenated dataset ('dataset.dat'). Two methods can be choosen: (1) nrow: split based on a fixed number of rows, (2) ncol: split based on a row that has a unique number of columns as an identifier. In case of method 'ncol' above: '--number 4' specifies that the row with unique number of columns has 4 columns (reference row); '--start -2' specifies the start line or row offset relative to the reference line; '--name 3' specifies the row offset relative to 'start line' that will be used for output file names;	'-o outdir' specifies output directory (it can be omitted for printing to the standard output)gdpmin*.xyz-v123gdpmax*.xyz-v123gdpsum*.xyz-v123gdpmean*.xyz-v123gdpmedian*.xyz-v123gdpstd*.xyz-v123Description:Output min, max, sum, mean, median, or std of the three first columns in *.xyz files.gdppip*.xyz--polygonpolygon.dat
gdppip*.xyz--polygonpolygon.dat-iDescription:Only output points inside or outside ('-i') of the given polygon. Alternatively '--lonrange' and '--latrange' flags could be used to define the polygon.gdpgriddervs_model/depth*--spacing0.2--smoothing50--polygonpolygon.dat-ooutdirDescription:This command will perform gridding (2D interpolation) to the input xyz format data files. In case of the above command: '--spacing 0.2' specifies that grid spacing along both longitude and latitude is 0.2 degrees (two values can be given as well; [lon_spacing, lat_spacing]); '--smoothing 50' sets a 50 km Gaussian smoothing to the output data; '--polygon polygon.dat' is optional: if given, only points inside the given polygon will be printed out.gdpmseed2sacmseed_dataset/*--reformat--offset-500--resample10-osac_datasetDescription:This command will convert mseed files in 'mseed_dataset'  to another directory named 'sac_dataset'. Flag '--reformat' will cause creating of sub-folders in the output directory in 'YYJJJHHMMSS' format, and the sacfiles within these sub-directories will be renamed as 'YYJJJHHMMSS_STA.CHN', where 'STA' is the station code and 'CHN' is the channel code. If reformat is enabled, offset time can be adjusted using '--offset'. Finally, '--resample 10' results in resampling of output timeseries to 10 Hz.gdpsac2datsac_dataset/*-otimeseries--timerange03600Description:This command will output the first hour (0-3600 s) of the sac data in sac_dataset/*gdpnc2datmodel.nc--metadata
gdpnc2datmodel.nc-vvsvp--fmt.2.6-omodel.datDescription:This tool can be used to convert NetCDF files to ascii format. In this example, by running the first command, the program will output meta data information related to 'model.nc'. It's necessary to figure out the data fields that one is interested to extract from the nc file first (in this case, they are 'vp' and 'vs'). The second command will print to file the results in a custom format to 'model.dat'.