{"id":38643718,"url":"https://github.com/oceanmodeling/xarray-selafin","last_synced_at":"2026-01-17T09:11:04.799Z","repository":{"id":223036205,"uuid":"759150307","full_name":"oceanmodeling/xarray-selafin","owner":"oceanmodeling","description":"An xarray engine for opening Selafin files (TELEMAC)","archived":false,"fork":false,"pushed_at":"2025-10-20T09:02:29.000Z","size":5032,"stargazers_count":7,"open_issues_count":10,"forks_count":3,"subscribers_count":7,"default_branch":"main","last_synced_at":"2025-10-23T11:37:41.681Z","etag":null,"topics":["telemac","xarray","xarray-extension"],"latest_commit_sha":null,"homepage":"https://pypi.org/project/xarray-selafin/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/oceanmodeling.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2024-02-17T19:33:20.000Z","updated_at":"2025-10-20T09:02:34.000Z","dependencies_parsed_at":"2024-03-01T09:31:48.833Z","dependency_job_id":"1bf69ffa-aaf3-43bb-b244-e8cd6d326a51","html_url":"https://github.com/oceanmodeling/xarray-selafin","commit_stats":null,"previous_names":["seareport/xarray-selafin","oceanmodeling/xarray-selafin"],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/oceanmodeling/xarray-selafin","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oceanmodeling%2Fxarray-selafin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oceanmodeling%2Fxarray-selafin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oceanmodeling%2Fxarray-selafin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oceanmodeling%2Fxarray-selafin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/oceanmodeling","download_url":"https://codeload.github.com/oceanmodeling/xarray-selafin/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oceanmodeling%2Fxarray-selafin/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28504904,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-17T06:57:29.758Z","status":"ssl_error","status_checked_at":"2026-01-17T06:56:03.931Z","response_time":85,"last_error":"SSL_read: 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":["telemac","xarray","xarray-extension"],"created_at":"2026-01-17T09:11:04.637Z","updated_at":"2026-01-17T09:11:04.747Z","avatar_url":"https://github.com/oceanmodeling.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Available on pypi](https://img.shields.io/pypi/v/xarray-selafin.svg)](https://pypi.python.org/pypi/xarray-selafin/)\n[![CI](https://github.com/oceanmodeling/xarray-selafin/actions/workflows/run_tests.yml/badge.svg)](https://github.com/oceanmodeling/xarray-selafin/actions/workflows/run_tests.yml)\n\n# xarray backend for Selafin formats\n\nSupports lazy loading by default.\n\n## Install\n\nTo have the backend working in xarray, you need to follow these steps:\n\n```\npip install xarray-selafin\n```\n\nor, if you are using conda/mamba:\n\n```\nconda install -c conda-forge xarray_selafin\n```\n\n## Read Selafin\n\n```python\nimport xarray as xr\n\nwith xr.open_dataset(\"tests/data/r3d_tidal_flats.slf\", engine=\"selafin\") as ds:\n    print(ds)  # do something with `ds`...\n    # `ds.close()` not necessary\n\nds = xr.open_dataset(\"tests/data/r3d_tidal_flats.slf\", lang=\"fr\", engine=\"selafin\")  # if variables are in French\nprint(ds)  # do something with `ds`...\nds.close()  # avoid a ResourceWarning (unclosed file)\n```\n\n```\n\u003cxarray.Dataset\u003e Size: 5MB\nDimensions:  (time: 17, plan: 21, node: 648)\nCoordinates:\n    x        (node) float32 3kB ...\n    y        (node) float32 3kB ...\n  * time     (time) datetime64[ns] 136B 1900-01-01 ... 1900-01-02T20:26:40\nDimensions without coordinates: plan, node\nData variables:\n    Z        (time, plan, node) float32 925kB ...\n    U        (time, plan, node) float32 925kB ...\n    V        (time, plan, node) float32 925kB ...\n    W        (time, plan, node) float32 925kB ...\n    MUD      (time, plan, node) float32 925kB ...\nAttributes:\n    title:       Sloped flume Rouse profile test\n    language:    en\n    float_size:  4\n    endian:      \u003e\n    params:      (1, 0, 0, 0, 0, 0, 21, 5544, 0, 1)\n    ipobo:       [   1  264  263 ... 5411 5412 5413]\n    ikle2:       [[155 153 156]\\n [310 307 305]\\n [308 310 305]\\n ...\\n [537 ...\n    ikle3:       [[  155   153   156   803   801   804]\\n [  310   307   305 ...\n    variables:   {'Z': ('ELEVATION Z', 'M'), 'U': ('VELOCITY U', 'M/S'), 'V':...\n    date_start:  (1900, 1, 1, 0, 0, 0)\n```\n\n## Indexing\n\n```python\nds_last = ds.isel(time=-1)  # last frame\n```\n\n## Manipulate variables\n\n```python\nds = ds.assign(UTIMES100=lambda x: x.U * 100)  # Add a new variable\n# ds.attrs[\"variables\"][\"UTIMES100\"] = (\"UTIMES100\", \"My/Unit\")  # To provide variable name and unit (optional)\nds.drop_vars([\"W\"])  # Remove variable `VELOCITY W`\n```\n\n## Extracting a specific layer from a 3D DataSet\n\n```python\nds_bottom = ds.selafin.get_dataset_as_2d(plan=0)  # bottom layer\n```\n\n## Write Selafin\n\n```python\nds.selafin.write(\"output_file.slf\")\n```\n\n## DataSet content\n\n### Dimensions\nIn 2D:\n1. time\n2. node\n\nin 3D:\n1. time\n2. plan\n3. node\n\n### Coordinates\n\n| Coordinate | Description            |\n|------------|------------------------|\n| x          | East mesh coordinates  |\n| y          | North mesh coordinates |\n| time       | Datetime serie         |\n\n### Attributes\n\nAll attributes are optional except `ikle2`:\n\n| Attribute  | Description                                                             | Default value                  |\n|------------|-------------------------------------------------------------------------|--------------------------------|\n| title      | Serafin title                                                           | \"Converted with array-serafin\" |\n| language   | Language for variable detection                                         | \"en\"                           |\n| float_size | Float size                                                              | 4 (single precision)           |\n| endian     | File endianness                                                         | \"\u003e\"                            |\n| params     | Table of integer parameters                                             | (can be rebuilt)               |\n| ikle2      | Connectivity table in 2D (1-indexed)                                    | -                              |\n| ikle3      | Connectivity table in 3D (1-indexed, only in 3D, optional)              | (can be rebuilt from 2D)       |\n| variables  | Dictionary with variable names and units (key is variable abbreviation) | -                              |\n| date_start | Starting date with integers (year to seconds)                           | (from first time serie)        |\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foceanmodeling%2Fxarray-selafin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Foceanmodeling%2Fxarray-selafin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foceanmodeling%2Fxarray-selafin/lists"}