Ignore:
Timestamp:
Nov 3, 2018 5:09:40 PM (5 years ago)
Author:
gronemeier
Message:

Add information about reference point to output files; corrected calculation of longitude values in case crs is not defined in input file

File:
1 edited

Legend:

Unmodified
Added
Removed
  • palm/trunk/SOURCE/netcdf_interface_mod.f90

    r3467 r3485  
    2525! -----------------
    2626! $Id$
     27! Write geographic coordinates as global attributes to file.
     28!
     29! 3467 2018-10-30 19:05:21Z suehring
    2730! - Salsa implemented
    2831! - Bugfix convert_utm_to...
     
    338341
    339342    USE netcdf_data_input_mod,                                                 &
    340         ONLY: coord_ref_sys
     343        ONLY: coord_ref_sys, init_model
    341344
    342345    PRIVATE
     
    644647    USE land_surface_model_mod,                                                &
    645648        ONLY: lsm_define_netcdf_grid, nzb_soil, nzt_soil, nzs, zs
    646 
    647     USE netcdf_data_input_mod,                                                 &
    648         ONLY:  init_model
    649649
    650650    USE ocean_mod,                                                             &
     
    892892!
    893893!--       Define some global attributes of the dataset
    894           nc_stat = NF90_PUT_ATT( id_set_mask(mid,av), NF90_GLOBAL, &
    895                                   'Conventions', 'COARDS' )
    896           CALL netcdf_handle_error( 'netcdf_define_header', 464 )
     894          CALL netcdf_create_global_atts( id_set_mask(mid,av), 464 )
    897895
    898896          IF ( av == 0 )  THEN
     
    17471745!
    17481746!--       Define some global attributes of the dataset
    1749           nc_stat = NF90_PUT_ATT( id_set_3d(av), NF90_GLOBAL, 'Conventions',   &
    1750                                   'COARDS' )
    1751           CALL netcdf_handle_error( 'netcdf_define_header', 62 )
     1747          CALL netcdf_create_global_atts( id_set_3d(av), 62 )
    17521748
    17531749          IF ( av == 0 )  THEN
     
    27632759!
    27642760!--       Define some global attributes of the dataset
    2765           nc_stat = NF90_PUT_ATT( id_set_xy(av), NF90_GLOBAL, 'Conventions', &
    2766                                   'COARDS' )
    2767           CALL netcdf_handle_error( 'netcdf_define_header', 97 )
     2761          CALL netcdf_create_global_atts( id_set_xy(av), 97 )
    27682762
    27692763          IF ( av == 0 )  THEN
     
    38033797!
    38043798!--       Define some global attributes of the dataset
    3805           nc_stat = NF90_PUT_ATT( id_set_xz(av), NF90_GLOBAL, 'Conventions',   &
    3806                                   'COARDS' )
    3807           CALL netcdf_handle_error( 'netcdf_define_header', 140 )
     3799          CALL netcdf_create_global_atts( id_set_xz(av), 140 )
    38083800
    38093801          IF ( av == 0 )  THEN
     
    47424734!
    47434735!--       Define some global attributes of the dataset
    4744           nc_stat = NF90_PUT_ATT( id_set_yz(av), NF90_GLOBAL, 'Conventions',   &
    4745                                   'COARDS' )
    4746           CALL netcdf_handle_error( 'netcdf_define_header', 179 )
     4736          CALL netcdf_create_global_atts( id_set_yz(av), 179 )
    47474737
    47484738          IF ( av == 0 )  THEN
     
    56685658!
    56695659!--       Define some global attributes of the dataset
     5660          CALL netcdf_create_global_atts( id_set_pr, 451 )
     5661
    56705662          IF ( averaging_interval_pr /= 0.0_wp )  THEN
    56715663             WRITE (time_average_text,'('', '',F7.1,'' s average'')')          &
     
    60766068!
    60776069!--       Define some global attributes of the dataset
     6070          CALL netcdf_create_global_atts( id_set_ts, 329 )
     6071
    60786072          nc_stat = NF90_PUT_ATT( id_set_ts, NF90_GLOBAL, 'title',             &
    60796073                                  TRIM( run_description_header ) )
     
    73927386! Description:
    73937387! ------------
     7388!> Write a set of global attributes to file.
     7389!------------------------------------------------------------------------------!
     7390 SUBROUTINE netcdf_create_global_atts( ncid, error_no )
     7391
     7392    IMPLICIT NONE
     7393
     7394    INTEGER, INTENT(IN)  ::  error_no  !< error number
     7395    INTEGER, INTENT(IN)  ::  ncid      !< file id
     7396
     7397#if defined( __netcdf )
     7398    nc_stat = NF90_PUT_ATT( ncid, NF90_GLOBAL, 'Conventions',  &
     7399                            'COARDS' )
     7400    CALL netcdf_handle_error( 'netcdf_create_global_atts', error_no )
     7401    nc_stat = NF90_PUT_ATT( ncid, NF90_GLOBAL, 'origin_lat',  &
     7402                            init_model%latitude )
     7403    CALL netcdf_handle_error( 'netcdf_create_global_atts', error_no )
     7404    nc_stat = NF90_PUT_ATT( ncid, NF90_GLOBAL, 'origin_lon',  &
     7405                            init_model%longitude )
     7406    CALL netcdf_handle_error( 'netcdf_create_global_atts', error_no )
     7407    nc_stat = NF90_PUT_ATT( ncid, NF90_GLOBAL, 'origin_x',  &
     7408                            init_model%origin_x )
     7409    CALL netcdf_handle_error( 'netcdf_create_global_atts', error_no )
     7410    nc_stat = NF90_PUT_ATT( ncid, NF90_GLOBAL, 'origin_y',  &
     7411                            init_model%origin_y )
     7412    CALL netcdf_handle_error( 'netcdf_create_global_atts', error_no )
     7413    nc_stat = NF90_PUT_ATT( ncid, NF90_GLOBAL, 'origin_z',  &
     7414                            init_model%origin_z )
     7415    CALL netcdf_handle_error( 'netcdf_create_global_atts', error_no )
     7416    nc_stat = NF90_PUT_ATT( ncid, NF90_GLOBAL, 'rotation_angle',  &
     7417                            init_model%rotation_angle )
     7418    CALL netcdf_handle_error( 'netcdf_create_global_atts', error_no )
     7419#endif
     7420
     7421 END SUBROUTINE netcdf_create_global_atts
     7422
     7423!------------------------------------------------------------------------------!
     7424! Description:
     7425! ------------
    73947426!> Create a variable holding the coordinate-reference-system information.
    73957427!------------------------------------------------------------------------------!
    73967428 SUBROUTINE netcdf_create_crs( ncid, error_no )
    73977429
    7398 #if defined( __netcdf )
    73997430    IMPLICIT NONE
    74007431
     
    74037434    INTEGER              ::  var_id    !< variable id
    74047435
     7436#if defined( __netcdf )
    74057437!
    74067438!-- Define variable
Note: See TracChangeset for help on using the changeset viewer.