{"id":34037019,"url":"https://github.com/jmcconochie/wavespectra2dsplitfit","last_synced_at":"2026-04-02T17:28:11.335Z","repository":{"id":64252355,"uuid":"574092483","full_name":"jmcconochie/wavespectra2dsplitfit","owner":"jmcconochie","description":"Ocean wave 2D spectrum partitioning and fitting JONSWAP spectrum","archived":false,"fork":false,"pushed_at":"2023-02-07T01:33:54.000Z","size":69039,"stargazers_count":10,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-12-15T12:53:24.790Z","etag":null,"topics":["jonswap","ocean","partitioning","spectra","wave"],"latest_commit_sha":null,"homepage":"","language":"Jupyter Notebook","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jmcconochie.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2022-12-04T12:07:30.000Z","updated_at":"2025-08-31T15:04:41.000Z","dependencies_parsed_at":"2023-02-08T15:46:03.069Z","dependency_job_id":null,"html_url":"https://github.com/jmcconochie/wavespectra2dsplitfit","commit_stats":{"total_commits":32,"total_committers":1,"mean_commits":32.0,"dds":0.0,"last_synced_commit":"ed5cb81a2684dc1e4ff24572dc25a05f158fed27"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/jmcconochie/wavespectra2dsplitfit","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jmcconochie%2Fwavespectra2dsplitfit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jmcconochie%2Fwavespectra2dsplitfit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jmcconochie%2Fwavespectra2dsplitfit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jmcconochie%2Fwavespectra2dsplitfit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jmcconochie","download_url":"https://codeload.github.com/jmcconochie/wavespectra2dsplitfit/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jmcconochie%2Fwavespectra2dsplitfit/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31311536,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-02T12:59:32.332Z","status":"ssl_error","status_checked_at":"2026-04-02T12:54:48.875Z","response_time":89,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["jonswap","ocean","partitioning","spectra","wave"],"created_at":"2025-12-13T20:50:16.244Z","updated_at":"2026-04-02T17:28:11.328Z","avatar_url":"https://github.com/jmcconochie.png","language":"Jupyter Notebook","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Ocean Wave Spectra 2D Splitting/Fitting\n\n## Introduction\n\nThe main purpose of this package is to find parameters of JONSWAP wave spectra with spreading that, when recombined,\n best match the input 2D frequency direction wave spectra.  Given a 2D wave spectrum S(f,theta), the package\n finds parameters of multiple JONSWAP partitions including wave spreading (i.e. Hs, Tp, Gamma, Tail exponent, ThetaP).  \n\nThe aim of the package is to provide an industry wide approach to derive usable wave spectral parameters that\nprovide the best possible reconstruction of the input wave spectrum.  The method is designed to be tunable, but\nrobust in the default configuration.  A large number of observed and numerically modelled datasets have been tested \nduring the creation and validation of the method.\n\nIt is the intention that the package will be used by consultants and weather forecastors to improve the descriptions\nof the ocean wave partitions for use in operations and engineering applications.  It provides the metocean engineer\nwith a robust way to separate swells and wind seas.\n\n\n## Usage\n\nImport the waveSpec class\n```\nimport numpy as np\nfrom wavespectra2dsplitfit.S2DFit import readWaveSpectrum_mat\nfilename = 'data/ExampleWaveSpectraObservations.mat'\nf, th, S, sDate = readWaveSpectrum_mat(filename)\nS = S * np.pi/180 # convert from m^2/(Hz.rad) to m^2/(Hz.deg)\n   \n# Setup fitting configuration - simple example with no wind (also usually best setup with no wind)    \ntConfig = {\n    'maxPartitions': 3,\n    'useClustering': True,\n    'useWind': False,\n    'useFittedWindSea': False, \n    'useWindSeaInClustering': False,\n}\n\n# Just do the first spectrum\nfrom wavespectra2dsplitfit.S2DFit import fit2DSpectrum\nspecParms, fitStatus, diagOut = fit2DSpectrum(f[0], th[0], S[0,:,:], **tConfig)\nprint(specParms, fitStatus)\n\nfor tSpec in specParms:\n    print(\"===== PARTITION =====\")\n    print(\"Hs = \",tSpec[0])\n    print(\"Tp = \",tSpec[1])\n    print(\"Gamma = \",tSpec[2])\n    print(\"Sigma A = \",tSpec[3])\n    print(\"Sigma B = \",tSpec[4])\n    print(\"Tail Exp = \",tSpec[5])\n    print(\"ThetaP = \",tSpec[6])\nprint(\"===== FITTING OUTCOME =====\")\nprint(f\"Fitting successful: \",fitStatus[0])\nprint(f\"RMS error of fit: \",fitStatus[1])\nprint(f\"Number of function evalutions: \",fitStatus[2])\n\nfrom wavespectra2dsplitfit.S2DFit import plot2DFittingDiagnostics\nf, th, S, f_sm, th_sm, S_sm, wsMask, Tp_pk, ThetaP_pk, Tp_sel, ThetaP_sel, whichClus = diagOut\nplot2DFittingDiagnostics(\n    specParms, \n    f, th, S, \n    f_sm, th_sm, S_sm, \n    wsMask,\n    Tp_pk, ThetaP_pk, Tp_sel, ThetaP_sel, whichClus,\n    tConfig['useWind'], tConfig['useClustering'],\n    saveFigFilename = 'test',  \n    tag = \"S2DFit Simple Test\"  \n)\n```\n\n## Example Result\n\nCheck out the test.py script as an example with data.\n\n```\n$ python test.py\nOptimization terminated successfully.\n         Current function value: 0.082135\n         Iterations: 1082\n         Function evaluations: 1733\n[[0.5859285326910995, 4.716981132075468, 1.0000053476007895, 0.07, 0.09, -4.234276488479486, 300.0, 4.716981132075468], [0.6129423521749234, 7.812499999999995, 5.970526837658344, 0.07, 0.09, -5.140143260428807, 290.0, 7.812499999999995], [0.4047506936099149, 10.869565217391298, 1.0000041524068202, 0.07, 0.09, -15.401874257914326, 240.0, 10.869565217391298]] [True, 0.08213522716322981, 1733]\n===== PARTITION =====\nHs =  0.5859285326910995\nTp =  4.716981132075468\nGamma =  1.0000053476007895\nSigma A =  0.07\nSigma B =  0.09\nTail Exp =  -4.234276488479486\nThetaP =  300.0\n===== PARTITION =====\nHs =  0.6129423521749234\nTp =  7.812499999999995\nGamma =  5.970526837658344\nSigma A =  0.07\nSigma B =  0.09\nTail Exp =  -5.140143260428807\nThetaP =  290.0\n===== PARTITION =====\nHs =  0.4047506936099149\nTp =  10.869565217391298\nGamma =  1.0000041524068202\nSigma A =  0.07\nSigma B =  0.09\nTail Exp =  -15.401874257914326\nThetaP =  240.0\n===== FITTING OUTCOME =====\nFitting successful:  True\nRMS error of fit:  0.08213522716322981\nNumber of function evalutions:  1733\n```\n\n\nAn example of the input and output reconstructed spectrum are shown in the image\nbelow.\n\n![This is an example output image](test_pk.png)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjmcconochie%2Fwavespectra2dsplitfit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjmcconochie%2Fwavespectra2dsplitfit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjmcconochie%2Fwavespectra2dsplitfit/lists"}