Spectrum Power Density

Good afternoon all, please I want to plot Spectrum Power Density but for Documentary I saw this example

 gmt spectrum1d data.g -S256 -D1.5 -Ndata
 paste data.t data.g | gmt spectrum1d -S256 -D1.5 -Ndata -C > results.txt

but don’t quite understand or figure it out. I tried the first one it could not give me any result, I tried the second one it gave me

spectrum1d [WARNING]: File <stdin> is empty!
spectrum1d [ERROR]: Input data have 0 column(s) but at least 2 are needed"

Can someone help me out please. here is the data

2009	        0.0055093072
2009.002739726	0.0034960002
2009.0054794521	-0.0035264487
2009.0082191781	0.0079802661
2009.0109589041	0.0056652576
2009.0136986301	0.000437069
2009.0164383562	0.0039079928
2009.0191780822	-0.0037045527
2009.0219178082	-0.0011096335
2009.0246575342	0.005610393
2009.0273972603	-0.004874576
2009.0301369863	0.0029357317
2009.0328767123	-0.0059494761
2009.0356164384	-0.0035013957
2009.0383561644	0.0020581783
2009.0410958904	-5.53E-06
2009.0438356164	-0.0022182039
2009.0465753425	-0.0028319893
2009.0493150685	0.0036694419
2009.0520547945	0.0003053058
2009.0547945205	-0.0039866874
2009.0575342466	-0.0042619567
2009.0602739726	0.0122691776
2009.0630136986	-0.0015608835
2009.0657534247	0.0087391465
2009.0684931507	0.0050584693
2009.0712328767	-0.0101878732
2009.0739726027	1.94E-05
2009.0767123288	-0.0151403382
2009.0794520548	0.0024268806
2009.0821917808	0.0103405388
2009.0849315068	-0.0037590937
2009.0876712329	0.005005081
2009.0904109589	0.0058689949
2009.0931506849	0.0019666197
2009.095890411	-0.0015168838
2009.098630137	0.0008263629
2009.101369863	0.0018818151
2009.104109589	0.0027913601
2009.1068493151	0.0077681494
2009.1095890411	0.0104234605
2009.1123287671	0.0052778617
2009.1150684932	0.0046911689
2009.1178082192	0.0049609154
2009.1205479452	-0.0023776758
2009.1232876712	0.0039842282
2009.1260273973	0.0038105446
2009.1287671233	0.0062364931
2009.1315068493	0.0034224777
2009.1342465753	0.0031151968
2009.1369863014	0.0015606471
2009.1397260274	-0.0027971784
2009.1424657534	0.0030693266
2009.1452054795	0.0135496301
2009.1479452055	-0.0002835999
2009.1506849315	-0.012725013
2009.1534246575	0.0151723437
2009.1561643836	0.0041854611
2009.1589041096	0.004076701
2009.1616438356	-0.008358352
2009.1643835616	0.0016920314
2009.1671232877	-0.0074392176
2009.1698630137	-0.001882594
2009.1726027397	0.0015927976
2009.1753424658	-0.0035448491
2009.1780821918	-0.0003616011
2009.1808219178	0.0096360637
2009.1835616438	0.0028424148
2009.1863013699	0.0071495664
2009.1890410959	-0.0014112276
2009.1917808219	0.001343006
2009.1945205479	-0.0042096315
2009.197260274	-0.0043068241
2009.2	-0.0071019789
2009.202739726	0.0013977516
2009.2054794521	-0.0063673434
2009.2082191781	0.0007584812
2009.2109589041	0.0024683937
2009.2136986301	-0.0119301736
2009.2164383562	0.0002682453
2009.2191780822	-0.0112333264
2009.2219178082	0.0019770187
2009.2246575342	0.0001649429
2009.2273972603	-0.0057730992
2009.2301369863	0.002675006
2009.2328767123	-0.0087519995
2009.2356164384	0.0110890308
2009.2383561644	0.0055665242
2009.2409817352	0.0024970151
2009.2437214612	0.008135592
2009.2464611872	-0.0043125049
2009.2492009132	0.0032259783
2009.2519406393	0.0076357299
2009.2546803653	-0.0013712179
2009.2574200913	-0.0103876036
2009.2601598174	-0.0010967011
2009.2628995434	-0.0009072006
2009.2656392694	-0.0134676802
2009.2683789954	0.0040920027
2009.2711187215	0.0065415689
2009.2738584475	0.0166413696
2009.2765981735	-0.0048483657
2009.2793378995	-0.0145001899
2009.2820776256	0.0008831863
2009.2848173516	-0.014032654
2009.2875570776	-0.000643978
2009.3176940639	0.0080010834
2009.32043379	-0.0164165359
2009.323173516	-0.0073707872
2009.325913242	-0.0033043114
2009.328652968	-0.0050677005
2009.3313926941	-0.0194233025
2009.3341324201	-0.0076973935
2009.3368721461	-0.003540747
2009.9150684932	0.0089618814
2009.9178082192	-0.0066672298
2009.9205479452	0.0068257923
2009.9232876712	-0.0102833865
2009.9369863014	0.0235976922
2009.9506849315	0.0231256443
2009.9534246575	0.0073706323
2009.9561643836	0.001294433
2009.9589041096	0.0041561702
2009.9616438356	0.0143124501
2009.9643835616	0.0079820278
2009.9671232877	0.0019475074
2009.9698630137	0.0012740855
2009.9726027397	-0.0048608189
2009.9753424658	0.0014096334
2009.9780821918	0.0059081632
2009.9808219178	-0.0022257601
2009.9835616438	-0.0016570127
2009.9863013699	-0.006265002
2009.9890410959	-0.000107802
2009.9917808219	9.42E-05
2009.9945205479	-0.0083712958
2010	0.008268541
2010.002739726	0.0036813172
2010.0054794521	0.0006065017
2010.0082191781	-0.0021209261
2010.0109589041	-0.0019746514
2010.0136986301	-0.0016961427
2010.0164383562	-0.0024218582
2010.0191780822	0.0003702116
2010.0219178082	-0.004551433
2010.0246575342	-0.0058862279
2010.0273972603	-0.0076829417
2010.0301369863	-0.0029300981
2010.0602739726	0.0027063789
2010.0630136986	-0.0028339414
2010.0657534247	0.0064287642
2010.0684931507	0.0018353757
2010.0712328767	0.0029644877
2010.0739726027	0.0027382267
2010.0767123288	0.000350858
2010.0794520548	0.001829662
2010.0821917808	-0.0007606137
2010.0849315068	0.0022547089
2010.0931506849	0.0172439215
2010.095890411	-0.0048017114
2010.098630137	0.0026131603
2010.101369863	-0.0044581231
2010.104109589	0.0038054398
2010.1068493151	0.0026939204
2010.1095890411	-0.0006845685
2010.1123287671	0.0006727253
2010.1150684932	-0.0026690931
2010.1178082192	0.004663358
2010.1205479452	-0.0004575385
2010.1232876712	0.0115367466
2010.1260273973	0.006483258
2010.1287671233	-0.0064071722
2010.1315068493	-0.0057448393
2010.1342465753	-0.0022334322
2010.1369863014	-0.0029958586
2010.1397260274	-0.0039162946
2010.1424657534	-0.0065022164
2010.1452054795	-0.0073013617
2010.1479452055	-0.0184361119
2010.1698630137	-0.0006977543
2010.1726027397	-0.0056542188
2010.1890410959	0.013947912
2010.1917808219	0.001017212
2010.1945205479	-0.0027361275
2010.197260274	0.0007022251
2010.2	0.0016397415
2010.202739726	-0.0011446508
2010.2054794521	-0.0088916004
2010.2082191781	-0.0095107014
2010.2109589041	-0.0066297456
2010.2136986301	-0.0027750182

What it is the name of your data file? Was any file created on the folder?

The data file name is hyadis.dat. I used it in place of data.g, the first code didn’t work and second code gave me that initial errors I sent in my first message
Hoping to hear from you

Try this:

gmt spectrum1d hyadis.dat -i1 -S256 -D1.5 -Ndata

It seems that -S256 it is too big for your data. I try it and I get two columns with NaN values.

|0.322916666667|NaN|NaN|
|0.325520833333|NaN|NaN|
|0.328125|NaN|NaN|
|0.330729166667|NaN|NaN|

Try a smaller number (126, 64,32). For example with -S64.

|0.0104166666667|0.521566992475|0.301914104571|
|0.0208333333333|0.205789264945|0.119123108925|
|0.03125|0.0586385964336|0.0339435194155|
|0.0416666666667|0.0309630797926|0.0179232785917|
|0.0520833333333|0.0182589685881|0.0105693807914|

The problem is that you have a data file with 191 rows and you are asking spectrum1d to use 256 records for the calculation.

@pwessel should GMT give an error message for cases like this?

Seems like a good idea!

Please open a bug report on GitHub so we dont fdrget.

1 Like

Note: The original poster @parker needs to carefully read the -S documentation to understand what is being asked and why. This is not a black box that can be used without knowing what is being attempted.

Okay sir, I will make those changes as explained. Thanks