Using NetCDF4 from any language can be intimidating if directly using the low-level NetCDF4 API. NetCDF4 interfaces have sprung up for popular languages that Make NetCDF4 trivially easy to use, such as Python netcdf4. Now Fortran also has an easy, powerful object-oriented NetCDF4 interface named nc4fortran. nc4fortran builds and connects to your project using CMake or Meson. nc4fortran uses object-oriented Fortran standard code and is tested across multiple compilers including GFortran and Intel oneAPI. The efficient nc4fortran interface is polymorphic (rank/dimension and type-agnostic) from scalars through 7-D arrays. A companion library for HDF5 is h5fortran.
Nc4fortran is simpler to use than even Matlab NetCDF4 interface.
use nc4fortran type(netcdf_file) :: hf call hf%open('test.nc', status='new') call hf%write('/value1', 123.) call hf%close()