Index: /palm/trunk/SOURCE/netcdf_data_input_mod.f90
===================================================================
--- /palm/trunk/SOURCE/netcdf_data_input_mod.f90	(revision 3484)
+++ /palm/trunk/SOURCE/netcdf_data_input_mod.f90	(revision 3485)
@@ -25,4 +25,8 @@
 ! -----------------
 ! $Id$
+! - get central meridian from origin_lon if crs does not exist
+! - set default origin_lon to 0
+! 
+! 3483 2018-11-02 14:19:26Z raasch
 ! bugfix: misplaced directives for netCDF fixed
 ! 
@@ -362,5 +366,5 @@
        REAL(wp) ::  fill_w                  !< fill value for w
        REAL(wp) ::  latitude = 0.0_wp       !< latitude of the lower left corner
-       REAL(wp) ::  longitude = -3.0_wp     !< longitude of the lower left corner
+       REAL(wp) ::  longitude = 0.0_wp      !< longitude of the lower left corner
        REAL(wp) ::  origin_x = 500000.0_wp  !< UTM easting of the lower left corner
        REAL(wp) ::  origin_y = 0.0_wp       !< UTM northing of the lower left corner
@@ -958,4 +962,9 @@
                               coord_ref_sys%units,                             &
                               .FALSE., 'crs' )
+       ELSE
+!
+!--       Calculate central meridian from origin_lon
+          coord_ref_sys%longitude_of_central_meridian = &
+             CEILING( input_file_atts%origin_lon / 6.0_wp ) * 6.0_wp - 3.0_wp
        ENDIF
 !
Index: /palm/trunk/SOURCE/netcdf_interface_mod.f90
===================================================================
--- /palm/trunk/SOURCE/netcdf_interface_mod.f90	(revision 3484)
+++ /palm/trunk/SOURCE/netcdf_interface_mod.f90	(revision 3485)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id$
+! Write geographic coordinates as global attributes to file.
+! 
+! 3467 2018-10-30 19:05:21Z suehring
 ! - Salsa implemented
 ! - Bugfix convert_utm_to...
@@ -338,5 +341,5 @@
 
     USE netcdf_data_input_mod,                                                 &
-        ONLY: coord_ref_sys
+        ONLY: coord_ref_sys, init_model
 
     PRIVATE
@@ -644,7 +647,4 @@
     USE land_surface_model_mod,                                                &
         ONLY: lsm_define_netcdf_grid, nzb_soil, nzt_soil, nzs, zs
-
-    USE netcdf_data_input_mod,                                                 &
-        ONLY:  init_model
 
     USE ocean_mod,                                                             &
@@ -892,7 +892,5 @@
 !
 !--       Define some global attributes of the dataset
-          nc_stat = NF90_PUT_ATT( id_set_mask(mid,av), NF90_GLOBAL, &
-                                  'Conventions', 'COARDS' )
-          CALL netcdf_handle_error( 'netcdf_define_header', 464 )
+          CALL netcdf_create_global_atts( id_set_mask(mid,av), 464 )
 
           IF ( av == 0 )  THEN
@@ -1747,7 +1745,5 @@
 !
 !--       Define some global attributes of the dataset
-          nc_stat = NF90_PUT_ATT( id_set_3d(av), NF90_GLOBAL, 'Conventions',   &
-                                  'COARDS' )
-          CALL netcdf_handle_error( 'netcdf_define_header', 62 )
+          CALL netcdf_create_global_atts( id_set_3d(av), 62 )
 
           IF ( av == 0 )  THEN
@@ -2763,7 +2759,5 @@
 !
 !--       Define some global attributes of the dataset
-          nc_stat = NF90_PUT_ATT( id_set_xy(av), NF90_GLOBAL, 'Conventions', &
-                                  'COARDS' )
-          CALL netcdf_handle_error( 'netcdf_define_header', 97 )
+          CALL netcdf_create_global_atts( id_set_xy(av), 97 )
 
           IF ( av == 0 )  THEN
@@ -3803,7 +3797,5 @@
 !
 !--       Define some global attributes of the dataset
-          nc_stat = NF90_PUT_ATT( id_set_xz(av), NF90_GLOBAL, 'Conventions',   &
-                                  'COARDS' )
-          CALL netcdf_handle_error( 'netcdf_define_header', 140 )
+          CALL netcdf_create_global_atts( id_set_xz(av), 140 )
 
           IF ( av == 0 )  THEN
@@ -4742,7 +4734,5 @@
 !
 !--       Define some global attributes of the dataset
-          nc_stat = NF90_PUT_ATT( id_set_yz(av), NF90_GLOBAL, 'Conventions',   &
-                                  'COARDS' )
-          CALL netcdf_handle_error( 'netcdf_define_header', 179 )
+          CALL netcdf_create_global_atts( id_set_yz(av), 179 )
 
           IF ( av == 0 )  THEN
@@ -5668,4 +5658,6 @@
 !
 !--       Define some global attributes of the dataset
+          CALL netcdf_create_global_atts( id_set_pr, 451 )
+
           IF ( averaging_interval_pr /= 0.0_wp )  THEN
              WRITE (time_average_text,'('', '',F7.1,'' s average'')')          &
@@ -6076,4 +6068,6 @@
 !
 !--       Define some global attributes of the dataset
+          CALL netcdf_create_global_atts( id_set_ts, 329 )
+
           nc_stat = NF90_PUT_ATT( id_set_ts, NF90_GLOBAL, 'title',             &
                                   TRIM( run_description_header ) )
@@ -7392,9 +7386,46 @@
 ! Description:
 ! ------------
+!> Write a set of global attributes to file.
+!------------------------------------------------------------------------------!
+ SUBROUTINE netcdf_create_global_atts( ncid, error_no )
+
+    IMPLICIT NONE
+
+    INTEGER, INTENT(IN)  ::  error_no  !< error number
+    INTEGER, INTENT(IN)  ::  ncid      !< file id
+
+#if defined( __netcdf )
+    nc_stat = NF90_PUT_ATT( ncid, NF90_GLOBAL, 'Conventions',  &
+                            'COARDS' )
+    CALL netcdf_handle_error( 'netcdf_create_global_atts', error_no )
+    nc_stat = NF90_PUT_ATT( ncid, NF90_GLOBAL, 'origin_lat',  &
+                            init_model%latitude )
+    CALL netcdf_handle_error( 'netcdf_create_global_atts', error_no )
+    nc_stat = NF90_PUT_ATT( ncid, NF90_GLOBAL, 'origin_lon',  &
+                            init_model%longitude )
+    CALL netcdf_handle_error( 'netcdf_create_global_atts', error_no )
+    nc_stat = NF90_PUT_ATT( ncid, NF90_GLOBAL, 'origin_x',  &
+                            init_model%origin_x )
+    CALL netcdf_handle_error( 'netcdf_create_global_atts', error_no )
+    nc_stat = NF90_PUT_ATT( ncid, NF90_GLOBAL, 'origin_y',  &
+                            init_model%origin_y )
+    CALL netcdf_handle_error( 'netcdf_create_global_atts', error_no )
+    nc_stat = NF90_PUT_ATT( ncid, NF90_GLOBAL, 'origin_z',  &
+                            init_model%origin_z )
+    CALL netcdf_handle_error( 'netcdf_create_global_atts', error_no )
+    nc_stat = NF90_PUT_ATT( ncid, NF90_GLOBAL, 'rotation_angle',  &
+                            init_model%rotation_angle )
+    CALL netcdf_handle_error( 'netcdf_create_global_atts', error_no )
+#endif
+
+ END SUBROUTINE netcdf_create_global_atts
+
+!------------------------------------------------------------------------------!
+! Description:
+! ------------
 !> Create a variable holding the coordinate-reference-system information.
 !------------------------------------------------------------------------------!
  SUBROUTINE netcdf_create_crs( ncid, error_no )
 
-#if defined( __netcdf )
     IMPLICIT NONE
 
@@ -7403,4 +7434,5 @@
     INTEGER              ::  var_id    !< variable id
 
+#if defined( __netcdf )
 !
 !-- Define variable
