{"id":47885183,"url":"https://github.com/dongli/fiona","last_synced_at":"2026-04-04T02:13:57.912Z","repository":{"id":138507622,"uuid":"184204492","full_name":"dongli/fiona","owner":"dongli","description":"Fortran IO Netcdf Assembly","archived":false,"fork":false,"pushed_at":"2021-09-12T12:27:18.000Z","size":83,"stargazers_count":18,"open_issues_count":0,"forks_count":4,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-01-30T02:16:29.342Z","etag":null,"topics":["fortran","netcdf"],"latest_commit_sha":null,"homepage":null,"language":"Fortran","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/dongli.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":"2019-04-30T06:27:20.000Z","updated_at":"2023-07-22T11:24:57.000Z","dependencies_parsed_at":"2023-03-16T19:15:12.460Z","dependency_job_id":null,"html_url":"https://github.com/dongli/fiona","commit_stats":{"total_commits":85,"total_committers":6,"mean_commits":"14.166666666666666","dds":"0.21176470588235297","last_synced_commit":"a8619c36db706430effee9faec2982ab2dd24028"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/dongli/fiona","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dongli%2Ffiona","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dongli%2Ffiona/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dongli%2Ffiona/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dongli%2Ffiona/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dongli","download_url":"https://codeload.github.com/dongli/fiona/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dongli%2Ffiona/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31384906,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-04T01:22:39.193Z","status":"online","status_checked_at":"2026-04-04T02:00:07.569Z","response_time":60,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["fortran","netcdf"],"created_at":"2026-04-04T02:13:57.270Z","updated_at":"2026-04-04T02:13:57.904Z","avatar_url":"https://github.com/dongli.png","language":"Fortran","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Introduction\n\nFIONA stands for Fortran IO Netcdf Assembly, which encapsulates netCDF library for easy use.\n\n# Dependencies\n\n- NetCDF\n\n  You need to install netCDF by yourself and by any means (e.g. [STARMAN](https://github.com/dongli/starman))\n\n- [fortran-container](https://github.com/dongli/fortran-container)\n\n  It can be added to your project as another submodule.\n  \n```\n$ git submodule add https://github.com/dongli/fortran-container lib/container\n```\n\nIn your `CMakeLists.txt`:\n```cmake\nadd_subdirectory(lib/container)\ninclude_directories(${CMAKE_BINARY_DIR}/fortran_container) # Not sure why we need this.\n...\ntarget_link_libraries(... fortran_container)\n```\n\n# Usage\n\n## Step 1\n\nAdd FIONA as a submodule in you git project:\n\n```\n$ git submodule add https://github.com/dongli/fiona lib/fiona\n```\n\n## Step 2\n\nAdd the following line to your `CMakeLists.txt`:\n```cmake\nadd_subdirectory(lib/fiona)\n```\n\nThen link your executable or library with `fiona`:\n\n```cmake\ntarget_link_libraries(... fiona)\n```\n\nYou are good to build your project.\n\n## Step 3\n\nFor input, use the following paradigm:\n\n```fortran\nuse fiona\n\ncall fiona_init()\ncall fiona_create_dataset('grids', file_path=grids_file_path, mode='r')\ncall fiona_get_dim('grids', 'location_nv', size=nx) ! Get dimension size in one line!\n...\ncall fiona_start_input('grids')\ncall fiona_input('grids', 'vtx_p', x)\ncall fiona_end_input('grids')\n...\n```\n\nFor output:\n\n```fortran\nuse fiona\n\ncall fiona_create_dataset('mpas_mesh', file_path='mpas_mesh.' // trim(to_string(mesh%nCells)) // '.nc')\ncall fiona_add_att('mpas_mesh', 'on_a_sphere',   'YES')\ncall fiona_add_att('mpas_mesh', 'sphere_radius', 1.0d0)\n...\ncall fiona_add_dim('mpas_mesh', 'nCells',    size=mesh%nCells)\ncall fiona_add_dim('mpas_mesh', 'nEdges',    size=mesh%nEdges)\ncall fiona_add_dim('mpas_mesh', 'nVertices', size=mesh%nVertices)\n...\ncall fiona_add_var('mpas_mesh', 'latCell',   long_name='Latitude of all cell centers',        units='radian', dim_names=['nCells'], data_type='real(8)')\ncall fiona_add_var('mpas_mesh', 'lonCell',   long_name='Longitude of all cell centers',       units='radian', dim_names=['nCells'], data_type='real(8)')\ncall fiona_add_var('mpas_mesh', 'xCell',     long_name='x axis position of all cell centers', units='m',      dim_names=['nCells'], data_type='real(8)')\ncall fiona_add_var('mpas_mesh', 'yCell',     long_name='y axis position of all cell centers', units='m',      dim_names=['nCells'], data_type='real(8)')\ncall fiona_add_var('mpas_mesh', 'zCell',     long_name='z axis position of all cell centers', units='m',      dim_names=['nCells'], data_type='real(8)')\n...\ncall fiona_start_output('mpas_mesh')\ncall fiona_output('mpas_mesh', 'latCell',    mesh%latCell)\ncall fiona_output('mpas_mesh', 'lonCell',    mesh%lonCell)\ncall fiona_output('mpas_mesh', 'xCell',      mesh%xCell)\ncall fiona_output('mpas_mesh', 'yCell',      mesh%yCell)\ncall fiona_output('mpas_mesh', 'zCell',      mesh%zCell)\n...\ncall fiona_end_output('mpas_mesh')\n```\n\nFor parallel input:\n\n```fortran\nuse fiona\n\ncharacter(...) paths(...)\ninteger num_x, num_y\ninteger time_start_idx, time_end_idx, time_idx\nreal(8), allocatable :: f(:,:,:) ! with dimensions x, y, time (the variant dimension of the dataset bundle is usually time.)\n\n! Set sorted paths.\n\ncall fiona_init()\n\ncall fiona_open_dataset('h0', file_paths=paths, mode='r', parallel=.true., mpi_com=mpi_comm)\ncall fiona_get_dim('h0', 'x', size=num_x)\ncall fiona_get_dim('h0', 'y', size=num_y)\ncall fiona_get_dim('h0', 'time', start_idx=time_start_idx, end_idx=time_end_idx)\nallocate(f(num_x,num_y,time_start_idx:time_end_idx))\n! Read time series (maybe partial of the file), each process reads its assigned partition.\ndo time_idx = time_start_idx, time_end_idx\n  call fiona_start_input('h0', file_idx=time_idx)\n  call fiona_input('h0', 'f', f(:,:,time_idx))\n  call fiona_end_input('h0')\nend do\n! By now, each process should already get data for its partition.\n! Do some calculation, and reduce the results to root process or all processes.\n```\n\nIt is your turn to simplify your callings on netCDF!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdongli%2Ffiona","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdongli%2Ffiona","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdongli%2Ffiona/lists"}