Changeset 3942 for palm/trunk


Ignore:
Timestamp:
Apr 30, 2019 1:08:30 PM (6 years ago)
Author:
kanani
Message:

Fix too short driver attribute lengths, and individualize error messages (netcdf_data_input_mod, netcdf_interface_mod)

Location:
palm/trunk/SOURCE
Files:
2 edited

Legend:

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

    r3941 r3942  
    2525! -----------------
    2626! $Id$
     27! Fix: increase LEN of all NetCDF attribute values (caused crash in
     28! netcdf_create_global_atts due to insufficient length)
     29!
     30! 3941 2019-04-30 09:48:33Z suehring
    2731! Move check for grid dimension to an earlier point in time when first array
    2832! is read.
     
    638642!-- attribute.
    639643    TYPE global_atts_type
    640        CHARACTER(LEN=12 ) ::  acronym                            !< acronym of institution
     644       CHARACTER(LEN=200) ::  acronym = ' '                      !< acronym of institution
    641645       CHARACTER(LEN=7)   ::  acronym_char = 'acronym'           !< name of attribute
    642        CHARACTER(LEN=200) ::  author                             !< first name, last name, email adress
     646       CHARACTER(LEN=200) ::  author  = ' '                      !< first name, last name, email adress
    643647       CHARACTER(LEN=6)   ::  author_char = 'author'             !< name of attribute
    644        CHARACTER(LEN=12 ) ::  campaign = 'PALM-4U'               !< name of campaign
     648       CHARACTER(LEN=200) ::  campaign = 'PALM-4U'               !< name of campaign
    645649       CHARACTER(LEN=8)   ::  campaign_char = 'campaign'         !< name of attribute
    646        CHARACTER(LEN=200) ::  comment                            !< comment to data
     650       CHARACTER(LEN=200) ::  comment = ' '                      !< comment to data
    647651       CHARACTER(LEN=7)   ::  comment_char = 'comment'           !< name of attribute
    648        CHARACTER(LEN=200) ::  contact_person                     !< first name, last name, email adress
     652       CHARACTER(LEN=200) ::  contact_person = ' '               !< first name, last name, email adress
    649653       CHARACTER(LEN=14)  ::  contact_person_char = 'contact_person'  !< name of attribute
    650654       CHARACTER(LEN=200) ::  conventions = 'CF-1.7'             !< netCDF convention
    651655       CHARACTER(LEN=11)  ::  conventions_char = 'Conventions'   !< name of attribute
    652        CHARACTER(LEN=23 ) ::  creation_time                      !< creation time of data set
     656       CHARACTER(LEN=23 ) ::  creation_time = ' '                !< creation time of data set
    653657       CHARACTER(LEN=13)  ::  creation_time_char = 'creation_time'  !< name of attribute
    654        CHARACTER(LEN=16 ) ::  data_content                       !< content of data set
     658       CHARACTER(LEN=200) ::  data_content = ' '                 !< content of data set
    655659       CHARACTER(LEN=12)  ::  data_content_char = 'data_content' !< name of attribute
    656        CHARACTER(LEN=200) ::  dependencies                       !< dependencies of data set
     660       CHARACTER(LEN=200) ::  dependencies = ' '                 !< dependencies of data set
    657661       CHARACTER(LEN=12)  ::  dependencies_char = 'dependencies' !< name of attribute
    658        CHARACTER(LEN=200) ::  history                            !< information about data processing
     662       CHARACTER(LEN=200) ::  history = ' '                      !< information about data processing
    659663       CHARACTER(LEN=7)   ::  history_char = 'history'           !< name of attribute
    660        CHARACTER(LEN=200) ::  institution                        !< name of responsible institution
     664       CHARACTER(LEN=200) ::  institution = ' '                  !< name of responsible institution
    661665       CHARACTER(LEN=11)  ::  institution_char = 'institution'   !< name of attribute
    662        CHARACTER(LEN=200) ::  keywords                           !< keywords of data set
     666       CHARACTER(LEN=200) ::  keywords = ' '                     !< keywords of data set
    663667       CHARACTER(LEN=8)   ::  keywords_char = 'keywords'         !< name of attribute
    664        CHARACTER(LEN=200) ::  licence                            !< licence of data set
     668       CHARACTER(LEN=200) ::  licence = ' '                      !< licence of data set
    665669       CHARACTER(LEN=7)   ::  licence_char = 'licence'           !< name of attribute
    666        CHARACTER(LEN=200) ::  location                           !< place which refers to data set
     670       CHARACTER(LEN=200) ::  location = ' '                     !< place which refers to data set
    667671       CHARACTER(LEN=8)   ::  location_char = 'location'         !< name of attribute
    668672       CHARACTER(LEN=10)  ::  origin_lat_char = 'origin_lat'     !< name of attribute
     
    674678       CHARACTER(LEN=8)   ::  origin_z_char = 'origin_z'         !< name of attribute
    675679       CHARACTER(LEN=12)  ::  palm_version_char = 'palm_version' !< name of attribute
    676        CHARACTER(LEN=200) ::  references                         !< literature referring to data set
     680       CHARACTER(LEN=200) ::  references = ' '                   !< literature referring to data set
    677681       CHARACTER(LEN=10)  ::  references_char = 'references'     !< name of attribute
    678682       CHARACTER(LEN=14)  ::  rotation_angle_char = 'rotation_angle'  !< name of attribute
    679        CHARACTER(LEN=12 ) ::  site                               !< name of model domain
     683       CHARACTER(LEN=200) ::  site = ' '                         !< name of model domain
    680684       CHARACTER(LEN=4)   ::  site_char = 'site'                 !< name of attribute
    681        CHARACTER(LEN=200) ::  source                             !< source of data set
     685       CHARACTER(LEN=200) ::  source = ' '                       !< source of data set
    682686       CHARACTER(LEN=6)   ::  source_char = 'source'             !< name of attribute
    683        CHARACTER(LEN=200) ::  title                              !< title of data set
     687       CHARACTER(LEN=200) ::  title = ' '                        !< title of data set
    684688       CHARACTER(LEN=5)   ::  title_char = 'title'               !< name of attribute
    685689       CHARACTER(LEN=7)   ::  version_char = 'version'           !< name of attribute
  • palm/trunk/SOURCE/netcdf_interface_mod.f90

    r3766 r3942  
    2525! -----------------
    2626! $Id$
     27! Add specifier to netcdf_handle_error to simplify identification of attribute
     28! causing the error
     29!
     30! 3766 2019-02-26 16:23:41Z raasch
    2731! bugfix in im_define_netcdf_grid argument list
    2832!
     
    71017105#if defined( __netcdf )
    71027106    nc_stat = NF90_PUT_ATT( ncid, NF90_GLOBAL, 'title', TRIM( title ) )
    7103     CALL netcdf_handle_error( 'netcdf_create_global_atts', error_no )
     7107    CALL netcdf_handle_error( 'netcdf_create_global_atts 1', error_no )
    71047108    nc_stat = NF90_PUT_ATT( ncid, NF90_GLOBAL, 'Conventions', 'CF-1.7' )
    7105     CALL netcdf_handle_error( 'netcdf_create_global_atts', error_no )
     7109    CALL netcdf_handle_error( 'netcdf_create_global_atts 2', error_no )
    71067110    nc_stat = NF90_PUT_ATT( ncid, NF90_GLOBAL, 'creation_time', TRIM( run_date )//' '//TRIM( run_time )//' '//run_zone(1:3) )
    7107     CALL netcdf_handle_error( 'netcdf_create_global_atts', error_no )
     7111    CALL netcdf_handle_error( 'netcdf_create_global_atts 3', error_no )
    71087112    nc_stat = NF90_PUT_ATT( ncid, NF90_GLOBAL, 'data_content', TRIM(data_content) )
    7109     CALL netcdf_handle_error( 'netcdf_create_global_atts', error_no )
     7113    CALL netcdf_handle_error( 'netcdf_create_global_atts 4', error_no )
    71107114    nc_stat = NF90_PUT_ATT( ncid, NF90_GLOBAL, 'version', runnr+1 )
    7111     CALL netcdf_handle_error( 'netcdf_create_global_atts', error_no )
     7115    CALL netcdf_handle_error( 'netcdf_create_global_atts 5', error_no )
    71127116
    71137117    nc_stat = NF90_PUT_ATT( ncid, NF90_GLOBAL, 'origin_time', init_model%origin_time )
    7114     CALL netcdf_handle_error( 'netcdf_create_global_atts', error_no )
     7118    CALL netcdf_handle_error( 'netcdf_create_global_atts 6', error_no )
    71157119    nc_stat = NF90_PUT_ATT( ncid, NF90_GLOBAL, 'origin_lat', init_model%latitude )
    7116     CALL netcdf_handle_error( 'netcdf_create_global_atts', error_no )
     7120    CALL netcdf_handle_error( 'netcdf_create_global_atts 7', error_no )
    71177121    nc_stat = NF90_PUT_ATT( ncid, NF90_GLOBAL, 'origin_lon', init_model%longitude )
    7118     CALL netcdf_handle_error( 'netcdf_create_global_atts', error_no )
     7122    CALL netcdf_handle_error( 'netcdf_create_global_atts 8', error_no )
    71197123    nc_stat = NF90_PUT_ATT( ncid, NF90_GLOBAL, 'origin_x', init_model%origin_x )
    7120     CALL netcdf_handle_error( 'netcdf_create_global_atts', error_no )
     7124    CALL netcdf_handle_error( 'netcdf_create_global_atts 9', error_no )
    71217125    nc_stat = NF90_PUT_ATT( ncid, NF90_GLOBAL, 'origin_y', init_model%origin_y )
    7122     CALL netcdf_handle_error( 'netcdf_create_global_atts', error_no )
     7126    CALL netcdf_handle_error( 'netcdf_create_global_atts 10', error_no )
    71237127    nc_stat = NF90_PUT_ATT( ncid, NF90_GLOBAL, 'origin_z', init_model%origin_z )
    7124     CALL netcdf_handle_error( 'netcdf_create_global_atts', error_no )
     7128    CALL netcdf_handle_error( 'netcdf_create_global_atts 11', error_no )
    71257129    nc_stat = NF90_PUT_ATT( ncid, NF90_GLOBAL, 'rotation_angle', init_model%rotation_angle )
    7126     CALL netcdf_handle_error( 'netcdf_create_global_atts', error_no )
     7130    CALL netcdf_handle_error( 'netcdf_create_global_atts 12', error_no )
    71277131
    71287132    nc_stat = NF90_PUT_ATT( ncid, NF90_GLOBAL, 'dependencies', '' )
    7129     CALL netcdf_handle_error( 'netcdf_create_global_atts', error_no )
     7133    CALL netcdf_handle_error( 'netcdf_create_global_atts 13', error_no )
    71307134    nc_stat = NF90_PUT_ATT( ncid, NF90_GLOBAL, 'history', '' )
    7131     CALL netcdf_handle_error( 'netcdf_create_global_atts', error_no )
     7135    CALL netcdf_handle_error( 'netcdf_create_global_atts 14', error_no )
    71327136
    71337137    nc_stat = NF90_PUT_ATT( ncid, NF90_GLOBAL, TRIM( input_file_atts%author_char ), TRIM( input_file_atts%author ) )
    7134     CALL netcdf_handle_error( 'netcdf_create_global_atts', error_no )
     7138    CALL netcdf_handle_error( 'netcdf_create_global_atts 15', error_no )
    71357139    nc_stat = NF90_PUT_ATT( ncid, NF90_GLOBAL, TRIM( input_file_atts%contact_person_char ), TRIM( input_file_atts%contact_person ) )
    7136     CALL netcdf_handle_error( 'netcdf_create_global_atts', error_no )
     7140    CALL netcdf_handle_error( 'netcdf_create_global_atts 16', error_no )
    71377141    nc_stat = NF90_PUT_ATT( ncid, NF90_GLOBAL, TRIM( input_file_atts%institution_char ), TRIM( input_file_atts%institution ) )
    7138     CALL netcdf_handle_error( 'netcdf_create_global_atts', error_no )
     7142    CALL netcdf_handle_error( 'netcdf_create_global_atts 17', error_no )
    71397143    nc_stat = NF90_PUT_ATT( ncid, NF90_GLOBAL, TRIM( input_file_atts%acronym_char ), TRIM( input_file_atts%acronym ) )
    7140     CALL netcdf_handle_error( 'netcdf_create_global_atts', error_no )
     7144    CALL netcdf_handle_error( 'netcdf_create_global_atts 18', error_no )
    71417145
    71427146    nc_stat = NF90_PUT_ATT( ncid, NF90_GLOBAL, TRIM( input_file_atts%campaign_char ), TRIM( input_file_atts%campaign ) )
    7143     CALL netcdf_handle_error( 'netcdf_create_global_atts', error_no )
     7147    CALL netcdf_handle_error( 'netcdf_create_global_atts 19', error_no )
    71447148    nc_stat = NF90_PUT_ATT( ncid, NF90_GLOBAL, TRIM( input_file_atts%location_char ), TRIM( input_file_atts%location ) )
    7145     CALL netcdf_handle_error( 'netcdf_create_global_atts', error_no )
     7149    CALL netcdf_handle_error( 'netcdf_create_global_atts 20', error_no )
    71467150    nc_stat = NF90_PUT_ATT( ncid, NF90_GLOBAL, TRIM( input_file_atts%site_char ), TRIM( input_file_atts%site ) )
    7147     CALL netcdf_handle_error( 'netcdf_create_global_atts', error_no )
     7151    CALL netcdf_handle_error( 'netcdf_create_global_atts 21', error_no )
    71487152
    71497153    nc_stat = NF90_PUT_ATT( ncid, NF90_GLOBAL, 'source', TRIM( version )//' '//TRIM( revision ) )
    7150     CALL netcdf_handle_error( 'netcdf_create_global_atts', error_no )
     7154    CALL netcdf_handle_error( 'netcdf_create_global_atts 22', error_no )
    71517155    nc_stat = NF90_PUT_ATT( ncid, NF90_GLOBAL, TRIM( input_file_atts%references_char ), TRIM( input_file_atts%references ) )
    7152     CALL netcdf_handle_error( 'netcdf_create_global_atts', error_no )
     7156    CALL netcdf_handle_error( 'netcdf_create_global_atts 23', error_no )
    71537157    nc_stat = NF90_PUT_ATT( ncid, NF90_GLOBAL, TRIM( input_file_atts%keywords_char ), TRIM( input_file_atts%keywords ) )
    7154     CALL netcdf_handle_error( 'netcdf_create_global_atts', error_no )
     7158    CALL netcdf_handle_error( 'netcdf_create_global_atts 24', error_no )
    71557159    nc_stat = NF90_PUT_ATT( ncid, NF90_GLOBAL, TRIM( input_file_atts%licence_char ), TRIM( input_file_atts%licence ) )
    7156     CALL netcdf_handle_error( 'netcdf_create_global_atts', error_no )
     7160    CALL netcdf_handle_error( 'netcdf_create_global_atts 25', error_no )
    71577161    nc_stat = NF90_PUT_ATT( ncid, NF90_GLOBAL, TRIM( input_file_atts%comment_char ), TRIM( input_file_atts%comment ) )
    7158     CALL netcdf_handle_error( 'netcdf_create_global_atts', error_no )
     7162    CALL netcdf_handle_error( 'netcdf_create_global_atts 26', error_no )
    71597163
    71607164#endif
Note: See TracChangeset for help on using the changeset viewer.