{"id":19872174,"url":"https://github.com/geospace-code/nc4fortran","last_synced_at":"2026-02-28T06:24:07.533Z","repository":{"id":47410214,"uuid":"229812591","full_name":"geospace-code/nc4fortran","owner":"geospace-code","description":"Object-oriented Fortran NetCDF4 interface","archived":false,"fork":false,"pushed_at":"2025-06-05T12:46:22.000Z","size":498,"stargazers_count":43,"open_issues_count":0,"forks_count":9,"subscribers_count":3,"default_branch":"main","last_synced_at":"2026-01-27T10:48:01.458Z","etag":null,"topics":["netcdf4","object-oriented-fortran"],"latest_commit_sha":null,"homepage":"","language":"CMake","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/geospace-code.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":"CITATION.cff","codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":"codemeta.json","zenodo":null},"funding":{"github":["scivision"],"ko_fi":"scivision"}},"created_at":"2019-12-23T19:38:38.000Z","updated_at":"2026-01-26T14:44:14.000Z","dependencies_parsed_at":"2023-01-22T09:46:11.909Z","dependency_job_id":"ee8c152d-7039-41a1-b031-49ca0c07a60c","html_url":"https://github.com/geospace-code/nc4fortran","commit_stats":{"total_commits":303,"total_committers":2,"mean_commits":151.5,"dds":"0.0033003300330033403","last_synced_commit":"a13550f9fcb2739351dcf0eba4b73a52a1c4e5e3"},"previous_names":[],"tags_count":44,"template":false,"template_full_name":null,"purl":"pkg:github/geospace-code/nc4fortran","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/geospace-code%2Fnc4fortran","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/geospace-code%2Fnc4fortran/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/geospace-code%2Fnc4fortran/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/geospace-code%2Fnc4fortran/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/geospace-code","download_url":"https://codeload.github.com/geospace-code/nc4fortran/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/geospace-code%2Fnc4fortran/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29926322,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-27T19:37:42.220Z","status":"online","status_checked_at":"2026-02-28T02:00:07.010Z","response_time":90,"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":["netcdf4","object-oriented-fortran"],"created_at":"2024-11-12T16:14:42.633Z","updated_at":"2026-02-28T06:24:07.518Z","avatar_url":"https://github.com/geospace-code.png","language":"CMake","funding_links":["https://github.com/sponsors/scivision","https://ko-fi.com/scivision"],"categories":[],"sub_categories":[],"readme":"# Object-oriented Fortran NetCDF4 interface\n\n[![DOI](https://zenodo.org/badge/229812591.svg)](https://zenodo.org/badge/latestdoi/229812591)\n[![ci](https://github.com/geospace-code/nc4fortran/actions/workflows/ci.yml/badge.svg)](https://github.com/geospace-code/nc4fortran/actions/workflows/ci.yml)\n[![ci_windows](https://github.com/geospace-code/nc4fortran/actions/workflows/ci_windows.yml/badge.svg)](https://github.com/geospace-code/nc4fortran/actions/workflows/ci_windows.yml)\n[![ci_fpm](https://github.com/geospace-code/nc4fortran/actions/workflows/ci_fpm.yml/badge.svg)](https://github.com/geospace-code/nc4fortran/actions/workflows/ci_fpm.yml)\n\nSimple, robust, thin, object-oriented NetCDF4 polymorphic read/write interface.\nFor HDF5 see [h5fortran](https://github.com/geospace-code/h5fortran).\nDesigned for easy use as a CMake \"ExternalProject\" using **static** or **shared** linking.\nUses Fortran 2008 `submodule` for clean template structure.\nnc4fortran abstracts away the messy parts of NetCDF4 so that you can read/write various types/ranks of data with a single command.\nIn distinction from other high-level NetCDF4 interfaces, nc4fortran works to deduplicate code, using polymorphism wherever feasible, with an extensive test suite.\n\nPolymorphic API with read/write for types int32, int64, real32, real64 with rank:\n\n* scalar (0-D)\n* 1-D .. 7-D\n\nAlso:\n\n* read/write **character** variables.\n* read/write character, int, float, double attributes\n\nDatatypes are coerced as per standard Fortran rules.\nFor example, reading a float NetCDF4 variable into an integer Fortran variable:  42.3 =\u003e 42\n\nTested on systems with NetCDF4 including:\n\n* MacOS\n* Linux\n* Windows\n\nSee [API](./API.md) for usage.\n\n## Build\n\nRequirements:\n\n* modern Fortran compiler: examples: GCC \u0026ge; 7 or Intel oneAPI \u0026ge; 2021\n* NetCDF4 Fortran library\n  * Mac / Homebrew: `brew install gcc netcdf`\n  * Linux: `apt install gfortran libnetcdf-dev libnetcdff-dev`\n  * Windows Subsystem for Linux: `apt install gfortran libnetcdf-dev libnetcdff-dev`\n  * Windows Cygwin `libnetcdf-fortran-devel`\n\nNote that some precompiled NetCDF4 libraries include C / C++ without Fortran.\n\nBuild this NetCDF OO Fortran interface.\nThe library `libnc4fortran.a` is built, link it into your program as usual.\n\n### CMake\n\n```sh\ncmake -B build\ncmake --build build\n\n# optional\nctest --test-dir build\n```\n\nTo specify a particular NetCDF library, use\n\n```sh\ncmake -DNetCDF_ROOT=/path/to/netcdff -B build\n```\n\nor set environment variable `NetCDF_ROOT=/path/to/netcdff`\n\nTo not find existing netCDF (force build of netCDF from source) add option:\n\n```sh\ncmake -Dfind_netcdf=off -Bbuild\n```\n\nTo use nc4fortran as a CMake ExternalProject do like:\n\n```cmake\ninclude(FetchContent)\n\nFetchContent_Declare(nc4fortran_proj\nGIT_REPOSITORY https://github.com/geospace-code/nc4fortran.git\n)\n\nFetchContent_MakeAvailable(nc4fortran_proj)\n\n# ------------------------------------------------------\n# whatever your program is\nadd_executable(myProj main.f90)\ntarget_link_libraries(myProj nc4fortran::nc4fortran)\n```\n\n### Fortran Package Manager (fpm)\n\n```sh\nfpm build\nfpm test\nfpm install\n```\n\n## Acknowledgements\n\nnc4fortran was funded in part by NASA NNH19ZDA001N-HDEE grant 80NSSC20K0176.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgeospace-code%2Fnc4fortran","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgeospace-code%2Fnc4fortran","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgeospace-code%2Fnc4fortran/lists"}