nc4fortran

Object-oriented Fortran NetCDF4 interface

https://github.com/geospace-code/nc4fortran

Science Score: 54.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
    Links to: zenodo.org
  • Committers with academic emails
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (12.3%) to scientific vocabulary

Keywords

netcdf4 object-oriented-fortran
Last synced: 6 months ago · JSON representation ·

Repository

Object-oriented Fortran NetCDF4 interface

Basic Info
  • Host: GitHub
  • Owner: geospace-code
  • License: mit
  • Language: CMake
  • Default Branch: main
  • Homepage:
  • Size: 486 KB
Statistics
  • Stars: 42
  • Watchers: 3
  • Forks: 9
  • Open Issues: 0
  • Releases: 43
Topics
netcdf4 object-oriented-fortran
Created about 6 years ago · Last pushed 9 months ago
Metadata Files
Readme License Citation Codemeta

README.md

Object-oriented Fortran NetCDF4 interface

DOI ci ci_windows ci_fpm

Simple, robust, thin, object-oriented NetCDF4 polymorphic read/write interface. For HDF5 see h5fortran. Designed for easy use as a CMake "ExternalProject" using static or shared linking. Uses Fortran 2008 submodule for clean template structure. nc4fortran abstracts away the messy parts of NetCDF4 so that you can read/write various types/ranks of data with a single command. In distinction from other high-level NetCDF4 interfaces, nc4fortran works to deduplicate code, using polymorphism wherever feasible, with an extensive test suite.

Polymorphic API with read/write for types int32, int64, real32, real64 with rank:

  • scalar (0-D)
  • 1-D .. 7-D

Also:

  • read/write character variables.
  • read/write character, int, float, double attributes

Datatypes are coerced as per standard Fortran rules. For example, reading a float NetCDF4 variable into an integer Fortran variable: 42.3 => 42

Tested on systems with NetCDF4 including:

  • MacOS
  • Linux
  • Windows

See API for usage.

Build

Requirements:

  • modern Fortran compiler: examples: GCC ≥ 7 or Intel oneAPI ≥ 2021
  • NetCDF4 Fortran library
    • Mac / Homebrew: brew install gcc netcdf
    • Linux: apt install gfortran libnetcdf-dev libnetcdff-dev
    • Windows Subsystem for Linux: apt install gfortran libnetcdf-dev libnetcdff-dev
    • Windows Cygwin libnetcdf-fortran-devel

Note that some precompiled NetCDF4 libraries include C / C++ without Fortran.

Build this NetCDF OO Fortran interface. The library libnc4fortran.a is built, link it into your program as usual.

CMake

```sh cmake -B build cmake --build build

optional

ctest --test-dir build ```

To specify a particular NetCDF library, use

sh cmake -DNetCDF_ROOT=/path/to/netcdff -B build

or set environment variable NetCDF_ROOT=/path/to/netcdff

To not find existing netCDF (force build of netCDF from source) add option:

sh cmake -Dfind_netcdf=off -Bbuild

To use nc4fortran as a CMake ExternalProject do like:

```cmake include(FetchContent)

FetchContentDeclare(nc4fortranproj GIT_REPOSITORY https://github.com/geospace-code/nc4fortran.git )

FetchContentMakeAvailable(nc4fortranproj)

------------------------------------------------------

whatever your program is

addexecutable(myProj main.f90) targetlink_libraries(myProj nc4fortran::nc4fortran) ```

Fortran Package Manager (fpm)

sh fpm build fpm test fpm install

Acknowledgements

nc4fortran was funded in part by NASA NNH19ZDA001N-HDEE grant 80NSSC20K0176.

Owner

  • Name: Geospace code
  • Login: geospace-code
  • Kind: organization
  • Location: 1 au

GNSS and other geospace analysis programs

Citation (CITATION.cff)

cff-version: 1.2.0
authors:
  - family-names: Hirsch
    given-names: Michael
    orcid: https://orcid.org/0000-0002-1637-6526
title: nc4fortran
doi: 10.5281/zenodo.3598941

CodeMeta (codemeta.json)

{
  "@context": "https://doi.org/10.5063/schema/codemeta-2.0",
  "@type": "SoftwareSourceCode",
  "codeRepository": "https://github.com/geospace-code/nc4fortran",
  "contIntegration": "https://github.com/geospace-code/nc4fortran/actions",
  "dateModified": "2022-05-29",
  "downloadUrl": "https://github.com/geospace-code/nc4fortran/releases",
  "issueTracker": "https://github.com/geospace-code/nc4fortran/issues",
  "name": "nc4fortran",
  "identifier": "10.5281/zenodo.3757221",
  "description": "Lightweight object-oriented NetCDF4 Fortran interface",
  "applicationCategory": "file I/O",
  "developmentStatus": "active",
  "funder": {
    "@type": "Organization",
    "name": "NASA"
  },
  "keywords": [
    "netcdf4",
    "object-oriented"
  ],
  "programmingLanguage": [
    "Fortran"
  ],
  "author": [
    {
      "@type": "Person",
      "@id": "https://orcid.org/0000-0002-1637-6526",
      "givenName": "Michael",
      "familyName": "Hirsch"
    }
  ]
}

GitHub Events

Total
  • Issues event: 2
  • Watch event: 5
  • Issue comment event: 2
Last Year
  • Issues event: 2
  • Watch event: 5
  • Issue comment event: 2

Committers

Last synced: about 2 years ago

All Time
  • Total Commits: 303
  • Total Committers: 2
  • Avg Commits per committer: 151.5
  • Development Distribution Score (DDS): 0.003
Past Year
  • Commits: 24
  • Committers: 1
  • Avg Commits per committer: 24.0
  • Development Distribution Score (DDS): 0.0
Top Committers
Name Email Commits
Michael Hirsch s****n 302
Valdenor Nilo de Carvalho Junior n****j@g****m 1

Issues and Pull Requests

Last synced: 6 months ago

All Time
  • Total issues: 4
  • Total pull requests: 1
  • Average time to close issues: 26 days
  • Average time to close pull requests: 2 days
  • Total issue authors: 4
  • Total pull request authors: 1
  • Average comments per issue: 4.5
  • Average comments per pull request: 1.0
  • Merged pull requests: 1
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 0
  • Pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Issue authors: 0
  • Pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • pedroaugustosmribeiro (1)
  • Beliavsky (1)
  • mathomp4 (1)
  • MuellerSeb (1)
  • bhelgs (1)
Pull Request Authors
  • nilocj (1)
Top Labels
Issue Labels
bug (2) enhancement (1)
Pull Request Labels

Dependencies

.github/workflows/ci.yml actions
  • actions/checkout v3 composite
  • actions/setup-python v4 composite
  • actions/upload-artifact v3 composite
.github/workflows/ci_fpm.yml actions
  • actions/checkout v3 composite
  • fortran-lang/setup-fpm v4 composite
.github/workflows/ci_windows.yml actions
  • actions/checkout v3 composite
  • msys2/setup-msys2 v2 composite
.github/workflows/oneapi-linux.yml actions
  • actions/cache v3 composite
  • actions/checkout v3 composite