"Fossies" - the Fresh Open Source Software Archive

Member "netcdf-fortran-4.4.5/fortran/netcdf_attributes.f90" (31 Jan 2019, 16794 Bytes) of package /linux/misc/netcdf-fortran-4.4.5.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Fortran 90 source code syntax highlighting (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file. For more information about "netcdf_attributes.f90" see the Fossies "Dox" file reference documentation.

    1   !
    2   ! Attribute routines:
    3   !
    4   ! -------
    5   function nf90_copy_att(ncid_in, varid_in, name, ncid_out, varid_out)
    6     integer,             intent( in) :: ncid_in,  varid_in
    7     character (len = *), intent( in) :: name
    8     integer,             intent( in) :: ncid_out, varid_out
    9     integer                          :: nf90_copy_att
   10 
   11     nf90_copy_att = nf_copy_att(ncid_in, varid_in, name, ncid_out, varid_out)
   12   end function nf90_copy_att
   13   ! -------
   14   function nf90_rename_att(ncid, varid, curname, newname)
   15     integer,             intent( in) :: ncid,  varid
   16     character (len = *), intent( in) :: curname, newname
   17     integer                          :: nf90_rename_att
   18 
   19     nf90_rename_att = nf_rename_att(ncid, varid, curname, newname)
   20   end function nf90_rename_att
   21   ! -------
   22   function nf90_del_att(ncid, varid, name)
   23     integer,             intent( in) :: ncid, varid
   24     character (len = *), intent( in) :: name
   25     integer                          :: nf90_del_att
   26 
   27     nf90_del_att = nf_del_att(ncid, varid, name)
   28   end function nf90_del_att
   29   ! -------
   30   ! Attribute inquiry functions
   31   ! -------
   32   function nf90_inq_attname(ncid, varid, attnum, name)
   33     integer,             intent( in) :: ncid, varid, attnum
   34     character (len = *), intent(out) :: name
   35     integer                          :: nf90_inq_attname
   36 
   37     nf90_inq_attname = nf_inq_attname(ncid, varid, attnum, name)
   38   end function nf90_inq_attname
   39   ! -------
   40   function nf90_inquire_attribute(ncid, varid, name, xtype, len, attnum)
   41     integer,             intent( in)           :: ncid, varid
   42     character (len = *), intent( in)           :: name
   43     integer,             intent(out), optional :: xtype, len, attnum
   44     integer                                    :: nf90_inquire_attribute
   45 
   46     integer                          :: local_xtype, local_len
   47 
   48     ! Do we need to worry about not saving the state from this call?
   49     if(present(attnum)) &
   50       nf90_inquire_attribute = nf_inq_attid(ncid, varid, name, attnum)
   51     nf90_inquire_attribute   = nf_inq_att  (ncid, varid, name, local_xtype, local_len)
   52     if(present(xtype)) xtype = local_xtype
   53     if(present(len  )) len   = local_len
   54   end function nf90_inquire_attribute
   55   ! -------
   56   ! Put and get functions; these will get overloaded
   57   ! -------
   58   ! Text
   59   ! -------
   60   function nf90_put_att_text(ncid, varid, name, values)
   61     integer,                          intent( in) :: ncid, varid
   62     character(len = *),               intent( in) :: name
   63     character(len = *),               intent( in) :: values
   64     integer                                       :: nf90_put_att_text
   65 
   66     nf90_put_att_text = nf_put_att_text(ncid, varid, name, len_trim(values), trim(values))
   67   end function nf90_put_att_text
   68   ! -------
   69   function nf90_get_att_text(ncid, varid, name, values)
   70     integer,                          intent( in) :: ncid, varid
   71     character(len = *),               intent( in) :: name
   72     character(len = *),               intent(out) :: values
   73     integer                                       :: nf90_get_att_text
   74 
   75     values = ' '  !! make sure result will be blank padded
   76     nf90_get_att_text = nf_get_att_text(ncid, varid, name, values)
   77   end function nf90_get_att_text
   78   ! -------
   79   ! Integer attributes
   80   ! -------
   81   function nf90_put_att_OneByteInt(ncid, varid, name, values)
   82     integer,                                    intent( in) :: ncid, varid
   83     character(len = *),                         intent( in) :: name
   84     integer (kind =  OneByteInt), dimension(:), intent( in) :: values
   85     integer                                                 :: nf90_put_att_OneByteInt
   86 
   87     nf90_put_att_OneByteInt = nf_put_att_int1(ncid, varid, name, nf90_int1, size(values), values)
   88   end function nf90_put_att_OneByteInt
   89   ! -------
   90   function nf90_put_att_one_OneByteInt(ncid, varid, name, values)
   91     integer,                                    intent( in) :: ncid, varid
   92     character(len = *),                         intent( in) :: name
   93     integer (kind =  OneByteInt),               intent( in) :: values
   94     integer                                                 :: nf90_put_att_one_OneByteInt
   95 
   96     integer (kind =  OneByteInt), dimension(1)              :: valuesA
   97     valuesA(1) = values
   98     nf90_put_att_one_OneByteInt = nf_put_att_int1(ncid, varid, name, nf90_int1, 1, valuesA)
   99   end function nf90_put_att_one_OneByteInt
  100   ! -------
  101   function nf90_get_att_OneByteInt(ncid, varid, name, values)
  102     integer,                                    intent( in) :: ncid, varid
  103     character(len = *),                         intent( in) :: name
  104     integer (kind =  OneByteInt), dimension(:), intent(out) :: values
  105     integer                                                 :: nf90_get_att_OneByteInt
  106 
  107     nf90_get_att_OneByteInt = nf_get_att_int1(ncid, varid, name, values)
  108   end function nf90_get_att_OneByteInt
  109   ! -------
  110   function nf90_get_att_one_OneByteInt(ncid, varid, name, values)
  111     integer,                                    intent( in) :: ncid, varid
  112     character(len = *),                         intent( in) :: name
  113     integer (kind =  OneByteInt),               intent(out) :: values
  114     integer                                                 :: nf90_get_att_one_OneByteInt
  115 
  116     integer (kind =  OneByteInt), dimension(1)              :: valuesA
  117     nf90_get_att_one_OneByteInt = nf_get_att_int1(ncid, varid, name, valuesA)
  118     values = valuesA(1)
  119   end function nf90_get_att_one_OneByteInt
  120   ! -------
  121   function nf90_put_att_TwoByteInt(ncid, varid, name, values)
  122     integer,                                    intent( in) :: ncid, varid
  123     character(len = *),                         intent( in) :: name
  124     integer (kind =  TwoByteInt), dimension(:), intent( in) :: values
  125     integer                                                 :: nf90_put_att_TwoByteInt
  126 
  127     nf90_put_att_TwoByteInt = nf_put_att_int2(ncid, varid, name, nf90_int2, size(values), values)
  128   end function nf90_put_att_TwoByteInt
  129   ! -------
  130   function nf90_put_att_one_TwoByteInt(ncid, varid, name, values)
  131     integer,                                    intent( in) :: ncid, varid
  132     character(len = *),                         intent( in) :: name
  133     integer (kind =  TwoByteInt),               intent( in) :: values
  134     integer                                                 :: nf90_put_att_one_TwoByteInt
  135 
  136     integer (kind =  TwoByteInt), dimension(1)              :: valuesA
  137     valuesA(1) = values
  138     nf90_put_att_one_TwoByteInt = nf_put_att_int2(ncid, varid, name, nf90_int2, 1, valuesA)
  139   end function nf90_put_att_one_TwoByteInt
  140   ! -------
  141   function nf90_get_att_TwoByteInt(ncid, varid, name, values)
  142     integer,                                    intent( in) :: ncid, varid
  143     character(len = *),                         intent( in) :: name
  144     integer (kind =  TwoByteInt), dimension(:), intent(out) :: values
  145     integer                                                 :: nf90_get_att_TwoByteInt
  146 
  147     nf90_get_att_TwoByteInt = nf_get_att_int2(ncid, varid, name, values)
  148   end function nf90_get_att_TwoByteInt
  149   ! -------
  150   function nf90_get_att_one_TwoByteInt(ncid, varid, name, values)
  151     integer,                                    intent( in) :: ncid, varid
  152     character(len = *),                         intent( in) :: name
  153     integer (kind =  TwoByteInt),               intent(out) :: values
  154     integer                                                 :: nf90_get_att_one_TwoByteInt
  155 
  156     integer (kind =  TwoByteInt), dimension(1)              :: valuesA
  157     nf90_get_att_one_TwoByteInt = nf_get_att_int2(ncid, varid, name, valuesA)
  158     values = valuesA(1)
  159   end function nf90_get_att_one_TwoByteInt
  160   ! -------
  161   function nf90_put_att_FourByteInt(ncid, varid, name, values)
  162     integer,                                    intent( in) :: ncid, varid
  163     character(len = *),                         intent( in) :: name
  164     integer (kind = FourByteInt), dimension(:), intent( in) :: values
  165     integer                                                 :: nf90_put_att_FourByteInt
  166 
  167     nf90_put_att_FourByteInt = nf_put_att_int(ncid, varid, name, nf90_int, size(values), int(values))
  168   end function nf90_put_att_FourByteInt
  169   ! -------
  170   function nf90_put_att_one_FourByteInt(ncid, varid, name, values)
  171     integer,                                    intent( in) :: ncid, varid
  172     character(len = *),                         intent( in) :: name
  173     integer (kind = FourByteInt),               intent( in) :: values
  174     integer                                                 :: nf90_put_att_one_FourByteInt
  175 
  176     integer (kind = FourByteInt), dimension(1)              :: valuesA
  177     valuesA(1) = int(values)
  178     nf90_put_att_one_FourByteInt = nf_put_att_int(ncid, varid, name, nf90_int, 1, int(valuesA))
  179   end function nf90_put_att_one_FourByteInt
  180   ! -------
  181   function nf90_get_att_FourByteInt(ncid, varid, name, values)
  182     integer,                                    intent( in) :: ncid, varid
  183     character(len = *),                         intent( in) :: name
  184     integer (kind = FourByteInt), dimension(:), intent(out) :: values
  185     integer                                                 :: nf90_get_att_FourByteInt
  186     
  187     integer, dimension(size(values)) :: defaultInteger
  188 
  189     nf90_get_att_FourByteInt = nf_get_att_int(ncid, varid, name, defaultInteger)
  190     values(:) = defaultInteger(:)
  191   end function nf90_get_att_FourByteInt
  192   ! -------
  193   function nf90_get_att_one_FourByteInt(ncid, varid, name, values)
  194     integer,                                    intent( in) :: ncid, varid
  195     character(len = *),                         intent( in) :: name
  196     integer (kind = FourByteInt),               intent(out) :: values
  197     integer                                                 :: nf90_get_att_one_FourByteInt
  198 
  199     integer, dimension(1) :: defaultInteger
  200 
  201     nf90_get_att_one_FourByteInt = nf_get_att_int(ncid, varid, name, defaultInteger)
  202     values = defaultInteger(1)
  203   end function nf90_get_att_one_FourByteInt
  204   ! -------
  205   function nf90_put_att_EightByteInt(ncid, varid, name, values)
  206     integer,                                     intent( in) :: ncid, varid
  207     character(len = *),                          intent( in) :: name
  208     integer (kind = EightByteInt), dimension(:), intent( in) :: values
  209     integer                                                  :: nf90_put_att_EightByteInt
  210 
  211     nf90_put_att_EightByteInt = nf_put_att_int(ncid, varid, name, nf90_int, size(values), int(values))
  212   end function nf90_put_att_EightByteInt
  213   ! -------
  214   function nf90_put_att_one_EightByteInt(ncid, varid, name, values)
  215     integer,                                     intent( in) :: ncid, varid
  216     character(len = *),                          intent( in) :: name
  217     integer (kind = EightByteInt),               intent( in) :: values
  218     integer                                                  :: nf90_put_att_one_EightByteInt
  219 
  220     integer, dimension(1) :: valuesA
  221     valuesA(1) = values
  222     nf90_put_att_one_EightByteInt = nf_put_att_int(ncid, varid, name, nf90_int, 1, valuesA)
  223   end function nf90_put_att_one_EightByteInt
  224   ! -------
  225   function nf90_get_att_EightByteInt(ncid, varid, name, values)
  226     integer,                                     intent( in) :: ncid, varid
  227     character(len = *),                          intent( in) :: name
  228     integer (kind = EightByteInt), dimension(:), intent(out) :: values
  229     integer                                                 :: nf90_get_att_EightByteInt
  230     
  231     integer, dimension(size(values)) :: defaultInteger
  232 
  233     nf90_get_att_EightByteInt = nf_get_att_int(ncid, varid, name, defaultInteger)
  234     values(:) = defaultInteger(:)
  235   end function nf90_get_att_EightByteInt
  236   ! -------
  237   function nf90_get_att_one_EightByteInt(ncid, varid, name, values)
  238     integer,                                     intent( in) :: ncid, varid
  239     character(len = *),                          intent( in) :: name
  240     integer (kind = EightByteInt),               intent(out) :: values
  241     integer                                                 :: nf90_get_att_one_EightByteInt
  242 
  243     integer, dimension(1) :: defaultInteger
  244 
  245     nf90_get_att_one_EightByteInt = nf_get_att_int(ncid, varid, name, defaultInteger)
  246     values = defaultInteger(1)
  247   end function nf90_get_att_one_EightByteInt
  248   ! -------
  249   ! Real attributes
  250   ! -------
  251   function nf90_put_att_FourByteReal(ncid, varid, name, values)
  252     integer,                                   intent( in) :: ncid, varid
  253     character(len = *),                        intent( in) :: name
  254     real (kind =  FourByteReal), dimension(:), intent( in) :: values
  255     integer                                                :: nf90_put_att_FourByteReal
  256 
  257     nf90_put_att_FourByteReal = nf_put_att_real(ncid, varid, name, nf90_real4, size(values), values)
  258   end function nf90_put_att_FourByteReal
  259   ! -------
  260   function nf90_put_att_one_FourByteReal(ncid, varid, name, values)
  261     integer,                                   intent( in) :: ncid, varid
  262     character(len = *),                        intent( in) :: name
  263     real (kind =  FourByteReal),               intent( in) :: values
  264     integer                                                :: nf90_put_att_one_FourByteReal
  265 
  266     real (kind =  FourByteReal), dimension(1) :: valuesA
  267     valuesA(1) = values
  268     nf90_put_att_one_FourByteReal = nf_put_att_real(ncid, varid, name, nf90_real4, 1, valuesA)
  269   end function nf90_put_att_one_FourByteReal
  270   ! -------
  271   function nf90_get_att_FourByteReal(ncid, varid, name, values)
  272     integer,                                   intent( in) :: ncid, varid
  273     character(len = *),                        intent( in) :: name
  274     real (kind =  FourByteReal), dimension(:), intent(out) :: values
  275     integer                                                :: nf90_get_att_FourByteReal
  276 
  277     nf90_get_att_FourByteReal = nf_get_att_real(ncid, varid, name, values)
  278   end function nf90_get_att_FourByteReal
  279   ! -------
  280   function nf90_get_att_one_FourByteReal(ncid, varid, name, values)
  281     integer,                                   intent( in) :: ncid, varid
  282     character(len = *),                        intent( in) :: name
  283     real (kind =  FourByteReal),               intent(out) :: values
  284     integer                                                :: nf90_get_att_one_FourByteReal
  285 
  286     real (kind =  FourByteReal), dimension(1) :: valuesA
  287     nf90_get_att_one_FourByteReal = nf_get_att_real(ncid, varid, name, valuesA)
  288     values = valuesA(1)
  289   end function nf90_get_att_one_FourByteReal
  290   ! -------
  291   function nf90_put_att_EightByteReal(ncid, varid, name, values)
  292     integer,                                   intent( in) :: ncid, varid
  293     character(len = *),                        intent( in) :: name
  294     real (kind = EightByteReal), dimension(:), intent( in) :: values
  295     integer                                                :: nf90_put_att_EightByteReal
  296 
  297     nf90_put_att_EightByteReal = nf_put_att_double(ncid, varid, name, nf90_real8, size(values), values)
  298   end function nf90_put_att_EightByteReal
  299   ! -------
  300   function nf90_put_att_one_EightByteReal(ncid, varid, name, values)
  301     integer,                                   intent( in) :: ncid, varid
  302     character(len = *),                        intent( in) :: name
  303     real (kind = EightByteReal),               intent( in) :: values
  304     integer                                                :: nf90_put_att_one_EightByteReal
  305 
  306     real (kind = EightByteReal), dimension(1) :: valuesA
  307     valuesA(1) = values
  308     nf90_put_att_one_EightByteReal = nf_put_att_double(ncid, varid, name, nf90_real8, 1, valuesA)
  309   end function nf90_put_att_one_EightByteReal
  310   ! -------
  311   function nf90_get_att_EightByteReal(ncid, varid, name, values)
  312     integer,                                   intent( in) :: ncid, varid
  313     character(len = *),                        intent( in) :: name
  314     real (kind = EightByteReal), dimension(:), intent(out) :: values
  315     integer                                                :: nf90_get_att_EightByteReal
  316 
  317     nf90_get_att_EightByteReal = nf_get_att_double(ncid, varid, name, values)
  318   end function nf90_get_att_EightByteReal
  319   ! -------
  320   function nf90_get_att_one_EightByteReal(ncid, varid, name, values)
  321     integer,                                   intent( in) :: ncid, varid
  322     character(len = *),                        intent( in) :: name
  323     real (kind = EightByteReal),               intent(out) :: values
  324     integer                                                :: nf90_get_att_one_EightByteReal
  325 
  326     real (kind = EightByteReal), dimension(1) :: valuesA
  327     nf90_get_att_one_EightByteReal = nf_get_att_double(ncid, varid, name, valuesA)
  328     values = valuesA(1)
  329   end function nf90_get_att_one_EightByteReal
  330   ! -------