the netcdf fortran 90 interface guide - unidata .2 netcdf fortran 90 interface guide subroutine

Download The NetCDF Fortran 90 Interface Guide - Unidata .2 NetCDF Fortran 90 Interface Guide subroutine

Post on 09-Jul-2018

269 views

Category:

Documents

3 download

Embed Size (px)

TRANSCRIPT

  • The NetCDF Fortran 90 Interface GuideNetCDF Version 4.0-snapshot2008122406.1-beta2

    22 December 2008

    Robert PincusRuss Rew

  • Copyright c 2005-2006 University Corporation for Atmospheric Research

    Permission is granted to make and distribute verbatim copies of this manual provided thatthe copyright notice and these paragraphs are preserved on all copies. The software and anyaccompanying written materials are provided as is without warranty of any kind. UCARexpressly disclaims all warranties of any kind, either expressed or implied, including but notlimited to the implied warranties of merchantability and fitness for a particular purpose.The Unidata Program Center is managed by the University Corporation for AtmosphericResearch and sponsored by the National Science Foundation. Any opinions, findings, con-clusions, or recommendations expressed in this publication are those of the author(s) anddo not necessarily reflect the views of the National Science Foundation.Mention of any commercial company or product in this document does not constitute anendorsement by the Unidata Program Center. Unidata does not authorize any use ofinformation from this publication for advertising or publicity purposes.

  • i

    Table of Contents

    1 Use of the NetCDF Library . . . . . . . . . . . . . . . . . . . . 11.1 Creating a NetCDF Dataset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11.2 Reading a NetCDF Dataset with Known Names . . . . . . . . . . . . . . . . 21.3 Reading a netCDF Dataset with Unknown Names . . . . . . . . . . . . . . 21.4 Writing Data in an Existing NetCDF Dataset . . . . . . . . . . . . . . . . . . 31.5 Adding New Dimensions, Variables, Attributes . . . . . . . . . . . . . . . . . . 41.6 Error Handling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51.7 Compiling and Linking with the NetCDF Library . . . . . . . . . . . . . . . 6

    2 Datasets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72.1 Datasets Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72.2 NetCDF Library Interface Descriptions . . . . . . . . . . . . . . . . . . . . . . . . . 72.3 NF90 STRERROR . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82.4 Get netCDF library version: NF90 INQ LIBVERS . . . . . . . . . . . . . 82.5 NF90 CREATE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92.6 NF90 OPEN . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112.7 NF90 REDEF . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 122.8 NF90 ENDDEF . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 132.9 NF90 CLOSE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 142.10 NF90 INQUIRE Family . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 152.11 NF90 SYNC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 162.12 NF90 ABORT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 182.13 NF90 SET FILL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19

    3 Groups . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 213.1 Find a Group ID: NF90 INQ NCID . . . . . . . . . . . . . . . . . . . . . . . . . . . 213.2 Get a List of Groups in a Group: NF90 INQ GRPS . . . . . . . . . . . 223.3 Find all the Variables in a Group: NF90 INQ VARIDS . . . . . . . . 233.4 Find all Dimensions Visible in a Group: NF90 INQ DIMIDS . . 233.5 Find the Length of a Groups Full Name:

    NF90 INQ GRPNAME LEN . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 243.6 Find a Groups Name: NF90 INQ GRPNAME . . . . . . . . . . . . . . . . 253.7 Find a Groups Full Name: NF90 INQ GRPNAME FULL . . . . 263.8 Find a Groups Parent: NF90 INQ GRP PARENT . . . . . . . . . . . . 273.9 Create a New Group: NF90 DEF GRP . . . . . . . . . . . . . . . . . . . . . . . 28

    4 Dimensions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 314.1 Dimensions Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 314.2 NF90 DEF DIM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 314.3 NF90 INQ DIMID . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 324.4 NF90 INQUIRE DIMENSION . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 334.5 NF90 RENAME DIM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34

  • ii NetCDF Fortran 90 Interface Guide

    5 User Defined Data Types . . . . . . . . . . . . . . . . . . . . . 375.1 User Defined Types Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 375.2 Learn the IDs of All Types in Group: NF90 INQ TYPEIDS . . . 375.3 Learn About an User Defined Type: NF90 INQ TYPE . . . . . . . . 385.4 Learn About an User Defined Type: NF90 INQ USER TYPE

    . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 395.4.1 Set a Variable Length Array with

    NF90 PUT VLEN ELEMENT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 405.4.2 Set a Variable Length Array with

    NF90 GET VLEN ELEMENT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 415.5 Compound Types Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41

    5.5.1 Creating a Compound Type: NF90 DEF COMPOUND . . 425.5.2 Inserting a Field into a Compound Type:

    NF90 INSERT COMPOUND . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 435.5.3 Inserting an Array Field into a Compound Type:

    NF90 INSERT ARRAY COMPOUND . . . . . . . . . . . . . . . . . . . . . 445.5.4 Learn About a Compound Type: NF90 INQ COMPOUND

    . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 465.5.5 Learn About a Field of a Compound Type:

    NF90 INQ COMPOUND FIELD . . . . . . . . . . . . . . . . . . . . . . . . . . . 475.6 Variable Length Array Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . 49

    5.6.1 Define a Variable Length Array (VLEN): NF90 DEF VLEN. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49

    5.6.2 Learning about a Variable Length Array (VLEN) Type:NF90 INQ VLEN . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50

    5.6.3 Releasing Memory for a Variable Length Array (VLEN)Type: NF90 FREE VLEN . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51

    5.7 Opaque Type Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 525.7.1 Creating Opaque Types: NF90 DEF OPAQUE . . . . . . . . . . . 525.7.2 Learn About an Opaque Type: NF90 INQ OPAQUE . . . . . 53

    5.8 Enum Type Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 535.8.1 Creating a Enum Type: NF90 DEF ENUM . . . . . . . . . . . . . . 535.8.2 Inserting a Field into a Enum Type: NF90 INSERT ENUM

    . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 555.8.3 Learn About a Enum Type: NF90 INQ ENUM . . . . . . . . . . . 565.8.4 Learn the Name of a Enum Type: nf90 inq enum member

    . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 565.8.5 Learn the Name of a Enum Type: NF90 INQ ENUM IDENT

    . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57

    6 Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 596.1 Variables Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 596.2 Language Types Corresponding to netCDF external data types

    . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 596.3 Create a Variable: NF90_DEF_VAR . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 606.4 Define Chunking Parameters for a Variable:

    NF90_DEF_VAR_CHUNKING . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62

  • iii

    6.5 Learn About Chunking Parameters for a Variable:NF90_INQ_VAR_CHUNKING . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63

    6.6 Define Fill Parameters for a Variable: nf90_def_var_fill . . . . 646.7 Learn About Fill Parameters for a Variable: NF90_INQ_VAR_FILL

    . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 656.8 Define Compression Parameters for a Variable:

    NF90_DEF_VAR_DEFLATE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 666.9 Learn About Deflate Parameters for a Variable:

    NF90_INQ_VAR_DEFLATE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 676.10 Define Checksum Parameters for a Variable:

    NF90_DEF_VAR_FLETCHER32 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 686.11 Learn About Checksum Parameters for a Variable:

    NF90_INQ_VAR_FLETCHER32 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 696.12 Define Endianness of a Variable: NF90_DEF_VAR_ENDIAN . . . . . . 706.13 Learn About Endian Parameters for a

Recommended

View more >