Skip to content

nnikulshin/simple_netcdf

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

simple_netcdf

An object oriented Fortran library for reading and writing NetCDF files.

This library is a wrapper around the Unidata netcdf-fortran library (https://github.com/Unidata/netcdf-fortran). It utilizes modern Fortran features such as object orientation and operator overloading to provide an intuitive and high level user experience, similar to that provided by the netCDF4 library in Python.

License

Examples

NetCDF files can be created or opened by constructing an nc_Dataset object:

type(nc_Dataset) :: ds

ds = nc_Dataset("test.nc", mode_replace)

Dimensions and variables can be created using the nc_Dataset object's bound procedures:

type(nc_Variable) :: var

!...

call ds%create_dimension("dim3", 3)
var = ds%new_var("I3int", type_int, (/ "dim3", "dim3" /))

Arrays are written to the file simply by assignment to the nc_Variable object:

integer, dimension(3,3) :: arr

! Fill arr with values

var = arr

Arrays are read from a file simply by assigning an nc_Variable object to an allocatable array:

integer, dimension(:,:), allocatable :: arr_readin

!...

arr_readin = var

The array is automatically allocated to the correct size.

For more details see the contents of the examples directory.

About

A NetCDF library for modern Fortran

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published