1
1
! > @file
2
- ! ! @brief Output model data for a single tile and a single record .
3
- ! ! @author George Gayno @date 2018
2
+ ! ! @brief Write model categorical data for a single tile.
3
+ ! ! @author George Gayno NCEP/EMC @date 2022
4
4
5
- ! > Output model data for a single tile and a single
6
- ! ! record in netcdf format.
5
+ ! > Output categorical data such as vegetation type. Include
6
+ ! ! percentage of each category within a model grid box and
7
+ ! ! the dominate category.
7
8
! !
8
- ! ! @param[in] data_one_tile Data to be output (single tile).
9
- ! ! @param[in] lat_one_tile Latitude of tile.
10
- ! ! @param[in] lon_one_tile Longitude of tile.
11
- ! ! @param[in] field_idx Index of field within field name array.
12
- ! ! @param[in] i_mdl i dimensions of tile.
13
- ! ! @param[in] j_mdl j dimensions of tile.
9
+ ! ! @author George Gayno NCEP/EMC @date 2022
10
+ module output_frac_cats
11
+
12
+ implicit none
13
+
14
+ private
15
+
16
+ public :: output_driver
17
+
18
+ contains
19
+
20
+ ! > Driver routine to output model categorical data.
21
+ ! !
22
+ ! ! @param[in] data_one_tile The percentage of each category within a model grid cell.
23
+ ! ! @param[in] dom_cat_one_tile The dominate category within a model grid cell.
24
+ ! ! @param[in] lat_one_tile Latitude of each model grid cell.
25
+ ! ! @param[in] lon_one_tile Longitude of each model grid cell.
26
+ ! ! @param[in] i_mdl i dimension of model grid.
27
+ ! ! @param[in] j_mdl j dimension of model grid.
28
+ ! ! @param[in] num_categories Number of categories.
14
29
! ! @param[in] tile Tile number.
15
- ! ! @author George Gayno @date 2018
16
- subroutine output2 (data_one_tile , dom_cat_one_tile , lat_one_tile , lon_one_tile , i_mdl , j_mdl , &
17
- num_categories , tile )
30
+ ! ! @author George Gayno @date 2022
31
+ subroutine output_driver (data_one_tile , dom_cat_one_tile , lat_one_tile , lon_one_tile , &
32
+ i_mdl , j_mdl , num_categories , tile )
18
33
19
34
use mpi
20
35
use esmf
21
- use source_grid, only : field_names, &
22
- num_time_recs
36
+ use source_grid, only : field_names
23
37
use model_grid, only : grid_tiles
24
38
use program_setup, only : halo
25
39
@@ -29,7 +43,7 @@ subroutine output2(data_one_tile, dom_cat_one_tile, lat_one_tile, lon_one_tile,
29
43
30
44
real (esmf_kind_r4 ), intent (in ) :: data_one_tile(i_mdl,j_mdl,num_categories)
31
45
real (esmf_kind_r4 ), intent (in ) :: dom_cat_one_tile(i_mdl,j_mdl)
32
- real (esmf_kind_r4 ) :: lat_one_tile(i_mdl,j_mdl)
46
+ real (esmf_kind_r4 ), intent ( in ) :: lat_one_tile(i_mdl,j_mdl)
33
47
real (esmf_kind_r4 ), intent (in ) :: lon_one_tile(i_mdl,j_mdl)
34
48
35
49
character (len= 200 ) :: out_file
@@ -67,38 +81,48 @@ subroutine output2(data_one_tile, dom_cat_one_tile, lat_one_tile, lon_one_tile,
67
81
j_end = j_mdl - halo
68
82
i_out = i_end - i_start + 1
69
83
j_out = j_end - j_start + 1
70
- call writeit(out_file, i_out, j_out, num_categories, num_time_recs, &
84
+ call writeit(out_file, i_out, j_out, num_categories, &
71
85
lat_one_tile(i_start:i_end,j_start:j_end), &
72
86
lon_one_tile(i_start:i_end,j_start:j_end), &
73
87
data_one_tile(i_start:i_end,j_start:j_end,:), &
74
88
dom_cat_one_tile(i_start:i_end,j_start:j_end) )
75
89
print * ," - WILL WRITE FULL DOMAIN INCLUDING HALO."
76
- call writeit(out_file_with_halo, i_mdl, j_mdl, num_categories, num_time_recs, &
90
+ call writeit(out_file_with_halo, i_mdl, j_mdl, num_categories, &
77
91
lat_one_tile, lon_one_tile, data_one_tile, dom_cat_one_tile)
78
92
else
79
93
print * ," - WILL WRITE DATA."
80
- call writeit(out_file, i_mdl, j_mdl, num_categories, num_time_recs, &
94
+ call writeit(out_file, i_mdl, j_mdl, num_categories, &
81
95
lat_one_tile, lon_one_tile, data_one_tile, dom_cat_one_tile)
82
96
endif
83
97
84
98
return
85
99
86
- end subroutine output2
100
+ end subroutine output_driver
87
101
88
- subroutine writeit (out_file , iout , jout , num_categories , num_time_recs , &
102
+ ! > Write data to a netcdf file.
103
+ ! !
104
+ ! ! @param[in] out_file Output file name.
105
+ ! ! @param[in] iout i-dimension of data.
106
+ ! ! @param[in] jout j-dimension of data.
107
+ ! ! @param[in] num_categories Number of categories.
108
+ ! ! @param[in] latitude Latitude of data.
109
+ ! ! @param[in] latitude Longitude of data.
110
+ ! ! @param[in] data_pct Percentage of each category in each model grid cell.
111
+ ! ! @param[in] dominate_cat Dominate category in each model grid cell.
112
+ subroutine writeit (out_file , iout , jout , num_categories , &
89
113
latitude , longitude , data_pct , dominate_cat )
90
114
91
115
use esmf
92
116
use netcdf
93
117
use utils
94
- use source_grid, only : day_of_rec, source, field_names
118
+ use source_grid, only : day_of_rec, source, field_names, num_time_recs
95
119
use model_grid, only : missing
96
120
97
121
implicit none
98
122
99
123
character (len=* ), intent (in ) :: out_file
100
124
101
- integer , intent (in ) :: iout, jout, num_categories, num_time_recs
125
+ integer , intent (in ) :: iout, jout, num_categories
102
126
103
127
real (esmf_kind_r4 ), intent (in ) :: latitude(iout,jout)
104
128
real (esmf_kind_r4 ), intent (in ) :: longitude(iout,jout)
@@ -194,3 +218,5 @@ subroutine writeit(out_file, iout, jout, num_categories, num_time_recs, &
194
218
error = nf90_close(ncid)
195
219
196
220
end subroutine writeit
221
+
222
+ end module output_frac_cats
0 commit comments