41 subroutine write_netcdf(im, jm, slm, land_frac, oro, hprime, ntiles, tile, geolon, geolat, lon, lat)
44 integer,
intent(in):: im, jm, ntiles, tile
45 real,
intent(in) :: lon(im), lat(jm)
46 real,
intent(in),
dimension(im,jm) :: slm, oro, geolon, geolat, land_frac
47 real,
intent(in),
dimension(im,jm,14):: hprime
48 character(len=128) :: outfile
49 integer :: error, ncid
50 integer :: header_buffer_val = 16384
51 integer :: fsize=65536, inital = 0
53 integer :: dim_lon, dim_lat
54 integer :: id_geolon,id_geolat
55 integer :: id_slmsk,id_orog_raw,id_orog_filt,id_land_frac
56 integer :: id_stddev,id_convex
57 integer :: id_oa1,id_oa2,id_oa3,id_oa4
58 integer :: id_ol1,id_ol2,id_ol3,id_ol4
59 integer :: id_theta,id_gamma,id_sigma,id_elvmax
62 write(outfile,
'(a,i4.4,a)')
'out.oro.tile', tile,
'.nc' 64 outfile =
"out.oro.nc" 71 error = nf90_create(outfile, ior(nf90_netcdf4,nf90_classic_model), ncid, &
72 initialsize=inital, chunksize=fsize)
73 call netcdf_err(error,
'Creating file '//trim(outfile) )
75 error = nf90_def_dim(ncid,
'lon', dim1, dim_lon)
76 call netcdf_err(error,
'define dimension lon for file='//trim(outfile) )
77 error = nf90_def_dim(ncid,
'lat', dim2, dim_lat)
78 call netcdf_err(error,
'define dimension lat for file='//trim(outfile) )
82 error = nf90_def_var(ncid,
'geolon', nf90_float, (/dim_lon,dim_lat/), id_geolon)
83 call netcdf_err(error,
'define var geolon for file='//trim(outfile) )
84 error = nf90_put_att(ncid, id_geolon,
"long_name",
"Longitude")
85 call netcdf_err(error,
'define geolon name for file='//trim(outfile) )
86 error = nf90_put_att(ncid, id_geolon,
"units",
"degrees_east")
87 call netcdf_err(error,
'define geolon units for file='//trim(outfile) )
89 error = nf90_def_var(ncid,
'geolat', nf90_float, (/dim_lon,dim_lat/), id_geolat)
90 call netcdf_err(error,
'define var geolat for file='//trim(outfile) )
91 error = nf90_put_att(ncid, id_geolat,
"long_name",
"Latitude")
92 call netcdf_err(error,
'define geolat name for file='//trim(outfile) )
93 error = nf90_put_att(ncid, id_geolat,
"units",
"degrees_north")
94 call netcdf_err(error,
'define geolat units for file='//trim(outfile) )
96 error = nf90_def_var(ncid,
'slmsk', nf90_float,(/dim_lon,dim_lat/), id_slmsk)
97 call netcdf_err(error,
'define var slmsk for file='//trim(outfile) )
98 error = nf90_put_att(ncid, id_slmsk,
"coordinates",
"geolon geolat")
99 call netcdf_err(error,
'define slmsk coordinates for file='//trim(outfile) )
101 error = nf90_def_var(ncid,
'land_frac', nf90_float, (/dim_lon,dim_lat/), id_land_frac)
102 call netcdf_err(error,
'define var land_frac for file='//trim(outfile) )
103 error = nf90_put_att(ncid, id_land_frac,
"coordinates",
"geolon geolat")
104 call netcdf_err(error,
'define land_frac coordinates for file='//trim(outfile) )
106 error = nf90_def_var(ncid,
'orog_raw', nf90_float, (/dim_lon,dim_lat/), id_orog_raw)
107 call netcdf_err(error,
'define var orog_raw for file='//trim(outfile) )
108 error = nf90_put_att(ncid, id_orog_raw,
"coordinates",
"geolon geolat")
109 call netcdf_err(error,
'define orog_raw coordinates for file='//trim(outfile) )
111 error = nf90_def_var(ncid,
'orog_filt', nf90_float, (/dim_lon,dim_lat/), id_orog_filt)
112 call netcdf_err(error,
'define var orog_filt for file='//trim(outfile) )
113 error = nf90_put_att(ncid, id_orog_filt,
"coordinates",
"geolon geolat")
114 call netcdf_err(error,
'define orog_filt coordinates for file='//trim(outfile) )
116 error = nf90_def_var(ncid,
'stddev', nf90_float, (/dim_lon,dim_lat/), id_stddev)
117 call netcdf_err(error,
'define var stddev for file='//trim(outfile) )
118 error = nf90_put_att(ncid, id_stddev,
"coordinates",
"geolon geolat")
119 call netcdf_err(error,
'define stddev coordinates for file='//trim(outfile) )
121 error = nf90_def_var(ncid,
'convexity', nf90_float, (/dim_lon,dim_lat/), id_convex)
122 call netcdf_err(error,
'define var convexity for file='//trim(outfile) )
123 error = nf90_put_att(ncid, id_convex,
"coordinates",
"geolon geolat")
124 call netcdf_err(error,
'define convexity coordinates for file='//trim(outfile) )
126 error = nf90_def_var(ncid,
'oa1', nf90_float, (/dim_lon,dim_lat/), id_oa1)
127 call netcdf_err(error,
'define var oa1 for file='//trim(outfile) )
128 error = nf90_put_att(ncid, id_oa1,
"coordinates",
"geolon geolat")
129 call netcdf_err(error,
'define oa1 coordinates for file='//trim(outfile) )
130 error = nf90_def_var(ncid,
'oa2', nf90_float, (/dim_lon,dim_lat/), id_oa2)
131 call netcdf_err(error,
'define var oa2 for file='//trim(outfile) )
132 error = nf90_put_att(ncid, id_oa2,
"coordinates",
"geolon geolat")
133 call netcdf_err(error,
'define oa2 coordinates for file='//trim(outfile) )
134 error = nf90_def_var(ncid,
'oa3', nf90_float, (/dim_lon,dim_lat/), id_oa3)
135 call netcdf_err(error,
'define var oa3 for file='//trim(outfile) )
136 error = nf90_put_att(ncid, id_oa3,
"coordinates",
"geolon geolat")
137 call netcdf_err(error,
'define oa3 coordinates for file='//trim(outfile) )
138 error = nf90_def_var(ncid,
'oa4', nf90_float, (/dim_lon,dim_lat/), id_oa4)
139 call netcdf_err(error,
'define var oa4 for file='//trim(outfile) )
140 error = nf90_put_att(ncid, id_oa4,
"coordinates",
"geolon geolat")
141 call netcdf_err(error,
'define oa4 coordinates for file='//trim(outfile) )
143 error = nf90_def_var(ncid,
'ol1', nf90_float, (/dim_lon,dim_lat/), id_ol1)
144 call netcdf_err(error,
'define var ol1 for file='//trim(outfile) )
145 error = nf90_put_att(ncid, id_ol1,
"coordinates",
"geolon geolat")
146 call netcdf_err(error,
'define ol1 coordinates for file='//trim(outfile) )
147 error = nf90_def_var(ncid,
'ol2', nf90_float, (/dim_lon,dim_lat/), id_ol2)
148 call netcdf_err(error,
'define var ol2 for file='//trim(outfile) )
149 error = nf90_put_att(ncid, id_ol2,
"coordinates",
"geolon geolat")
150 call netcdf_err(error,
'define ol2 coordinates for file='//trim(outfile) )
151 error = nf90_def_var(ncid,
'ol3', nf90_float, (/dim_lon,dim_lat/), id_ol3)
152 call netcdf_err(error,
'define var ol3 for file='//trim(outfile) )
153 error = nf90_put_att(ncid, id_ol3,
"coordinates",
"geolon geolat")
154 call netcdf_err(error,
'define ol3 coordinates for file='//trim(outfile) )
155 error = nf90_def_var(ncid,
'ol4', nf90_float, (/dim_lon,dim_lat/), id_ol4)
156 call netcdf_err(error,
'define var ol4 for file='//trim(outfile) )
157 error = nf90_put_att(ncid, id_ol4,
"coordinates",
"geolon geolat")
158 call netcdf_err(error,
'define ol4 coordinates for file='//trim(outfile) )
160 error = nf90_def_var(ncid,
'theta', nf90_float, (/dim_lon,dim_lat/), id_theta)
161 call netcdf_err(error,
'define var theta for file='//trim(outfile) )
162 error = nf90_put_att(ncid, id_theta,
"coordinates",
"geolon geolat")
163 call netcdf_err(error,
'define theta coordinates for file='//trim(outfile) )
164 error = nf90_def_var(ncid,
'gamma', nf90_float, (/dim_lon,dim_lat/), id_gamma)
165 call netcdf_err(error,
'define var gamma for file='//trim(outfile) )
166 error = nf90_put_att(ncid, id_gamma,
"coordinates",
"geolon geolat")
167 call netcdf_err(error,
'define gamma coordinates for file='//trim(outfile) )
168 error = nf90_def_var(ncid,
'sigma', nf90_float, (/dim_lon,dim_lat/), id_sigma)
169 call netcdf_err(error,
'define var sigma for file='//trim(outfile) )
170 error = nf90_put_att(ncid, id_sigma,
"coordinates",
"geolon geolat")
171 call netcdf_err(error,
'define sigma coordinates for file='//trim(outfile) )
172 error = nf90_def_var(ncid,
'elvmax', nf90_float, (/dim_lon,dim_lat/), id_elvmax)
173 call netcdf_err(error,
'define var elvmax for file='//trim(outfile) )
174 error = nf90_put_att(ncid, id_elvmax,
"coordinates",
"geolon geolat")
175 call netcdf_err(error,
'define elvmax coordinates for file='//trim(outfile) )
177 error = nf90_enddef(ncid, header_buffer_val,4,0,4)
178 call netcdf_err(error,
'end meta define for file='//trim(outfile) )
181 error = nf90_put_var( ncid, id_geolon, geolon(:dim1,:dim2))
182 call netcdf_err(error,
'write var geolon for file='//trim(outfile) )
183 error = nf90_put_var( ncid, id_geolat, geolat(:dim1,:dim2))
184 call netcdf_err(error,
'write var geolat for file='//trim(outfile) )
186 error = nf90_put_var( ncid, id_slmsk, slm(:dim1,:dim2))
187 call netcdf_err(error,
'write var slmsk for file='//trim(outfile) )
188 error = nf90_put_var( ncid, id_land_frac, land_frac(:dim1,:dim2))
189 call netcdf_err(error,
'write var land_frac for file='//trim(outfile) )
191 error = nf90_put_var( ncid, id_orog_raw, oro(:dim1,:dim2))
192 call netcdf_err(error,
'write var orog_raw for file='//trim(outfile) )
194 error = nf90_put_var( ncid, id_orog_filt, oro(:dim1,:dim2))
195 call netcdf_err(error,
'write var orog_filt for file='//trim(outfile) )
197 error = nf90_put_var( ncid, id_stddev, hprime(:dim1,:dim2,1))
198 call netcdf_err(error,
'write var stddev for file='//trim(outfile) )
199 error = nf90_put_var( ncid, id_convex, hprime(:dim1,:dim2,2))
200 call netcdf_err(error,
'write var convex for file='//trim(outfile) )
202 error = nf90_put_var( ncid, id_oa1, hprime(:dim1,:dim2,3))
203 call netcdf_err(error,
'write var oa1 for file='//trim(outfile) )
204 error = nf90_put_var( ncid, id_oa2, hprime(:dim1,:dim2,4))
205 call netcdf_err(error,
'write var oa2 for file='//trim(outfile) )
206 error = nf90_put_var( ncid, id_oa3, hprime(:dim1,:dim2,5))
207 call netcdf_err(error,
'write var oa3 for file='//trim(outfile) )
208 error = nf90_put_var( ncid, id_oa4, hprime(:dim1,:dim2,6))
209 call netcdf_err(error,
'write var oa4 for file='//trim(outfile) )
211 error = nf90_put_var( ncid, id_ol1, hprime(:dim1,:dim2,7))
212 call netcdf_err(error,
'write var ol1 for file='//trim(outfile) )
213 error = nf90_put_var( ncid, id_ol2, hprime(:dim1,:dim2,8))
214 call netcdf_err(error,
'write var ol2 for file='//trim(outfile) )
215 error = nf90_put_var( ncid, id_ol3, hprime(:dim1,:dim2,9))
216 call netcdf_err(error,
'write var ol3 for file='//trim(outfile) )
217 error = nf90_put_var( ncid, id_ol4, hprime(:dim1,:dim2,10))
218 call netcdf_err(error,
'write var ol4 for file='//trim(outfile) )
220 error = nf90_put_var( ncid, id_theta, hprime(:dim1,:dim2,11))
221 call netcdf_err(error,
'write var theta for file='//trim(outfile) )
222 error = nf90_put_var( ncid, id_gamma, hprime(:dim1,:dim2,12))
223 call netcdf_err(error,
'write var gamma for file='//trim(outfile) )
224 error = nf90_put_var( ncid, id_sigma, hprime(:dim1,:dim2,13))
225 call netcdf_err(error,
'write var sigma for file='//trim(outfile) )
226 error = nf90_put_var( ncid, id_elvmax, hprime(:dim1,:dim2,14))
227 call netcdf_err(error,
'write var elvmax for file='//trim(outfile) )
229 error = nf90_close(ncid)
230 call netcdf_err(error,
'close file='//trim(outfile) )
242 integer,
intent(in) :: err
243 character(len=*),
intent(in) :: string
244 character(len=256) :: errmsg
246 if( err.EQ.nf90_noerr )
return 247 errmsg = nf90_strerror(err)
248 print*,
'FATAL ERROR: ', trim(string),
': ', trim(errmsg)
266 subroutine write_mask_netcdf(im, jm, slm, land_frac, ntiles, tile, geolon, geolat)
269 integer,
intent(in):: im, jm, ntiles, tile
270 real,
intent(in),
dimension(im,jm) :: slm, geolon, geolat, land_frac
271 character(len=128) :: outfile
272 integer :: error, ncid
273 integer :: header_buffer_val = 16384
274 integer :: fsize=65536, inital = 0
275 integer :: dim1, dim2
276 integer :: dim_lon, dim_lat
277 integer :: id_geolon,id_geolat
278 integer :: id_slmsk,id_land_frac
281 write(outfile,
'(a,i4.4,a)')
'out.oro.tile', tile,
'.nc' 283 outfile =
"out.oro.nc" 290 error = nf90_create(outfile, ior(nf90_netcdf4,nf90_classic_model), ncid, &
291 initialsize=inital, chunksize=fsize)
292 call netcdf_err(error,
'Creating file '//trim(outfile) )
294 error = nf90_def_dim(ncid,
'lon', dim1, dim_lon)
295 call netcdf_err(error,
'define dimension lon for file='//trim(outfile) )
296 error = nf90_def_dim(ncid,
'lat', dim2, dim_lat)
297 call netcdf_err(error,
'define dimension lat for file='//trim(outfile) )
301 error = nf90_def_var(ncid,
'geolon', nf90_float, (/dim_lon,dim_lat/), id_geolon)
302 call netcdf_err(error,
'define var geolon for file='//trim(outfile) )
303 error = nf90_put_att(ncid, id_geolon,
"long_name",
"Longitude")
304 call netcdf_err(error,
'define geolon name for file='//trim(outfile) )
305 error = nf90_put_att(ncid, id_geolon,
"units",
"degrees_east")
306 call netcdf_err(error,
'define geolon units for file='//trim(outfile) )
308 error = nf90_def_var(ncid,
'geolat', nf90_float, (/dim_lon,dim_lat/), id_geolat)
309 call netcdf_err(error,
'define var geolat for file='//trim(outfile) )
310 error = nf90_put_att(ncid, id_geolat,
"long_name",
"Latitude")
311 call netcdf_err(error,
'define geolat name for file='//trim(outfile) )
312 error = nf90_put_att(ncid, id_geolat,
"units",
"degrees_north")
313 call netcdf_err(error,
'define geolat units for file='//trim(outfile) )
315 error = nf90_def_var(ncid,
'slmsk', nf90_float, (/dim_lon,dim_lat/), id_slmsk)
316 call netcdf_err(error,
'define var slmsk for file='//trim(outfile) )
317 error = nf90_put_att(ncid, id_slmsk,
"coordinates",
"geolon geolat")
318 call netcdf_err(error,
'define slmsk coordinates for file='//trim(outfile) )
320 error = nf90_def_var(ncid,
'land_frac', nf90_float, (/dim_lon,dim_lat/), id_land_frac)
321 call netcdf_err(error,
'define var land_frac for file='//trim(outfile) )
322 error = nf90_put_att(ncid, id_land_frac,
"coordinates",
"geolon geolat")
323 call netcdf_err(error,
'define land_frac coordinates for file='//trim(outfile) )
325 error = nf90_enddef(ncid, header_buffer_val,4,0,4)
326 call netcdf_err(error,
'end meta define for file='//trim(outfile) )
329 error = nf90_put_var( ncid, id_geolon, geolon(:dim1,:dim2))
330 call netcdf_err(error,
'write var geolon for file='//trim(outfile) )
332 error = nf90_put_var( ncid, id_geolat, geolat(:dim1,:dim2))
333 call netcdf_err(error,
'write var geolat for file='//trim(outfile) )
335 error = nf90_put_var( ncid, id_slmsk, slm(:dim1,:dim2))
336 call netcdf_err(error,
'write var slmsk for file='//trim(outfile) )
338 error = nf90_put_var( ncid, id_land_frac, land_frac(:dim1,:dim2))
339 call netcdf_err(error,
'write var land_frac for file='//trim(outfile) )
341 error = nf90_close(ncid)
342 call netcdf_err(error,
'close file='//trim(outfile) )
356 subroutine read_mask(merge_file,slm,land_frac,lake_frac,im,jm)
362 character(len=*),
intent(in) :: merge_file
364 integer,
intent(in) :: im, jm
366 real,
intent(out) :: land_frac(im,jm)
368 real,
intent(out) :: slm(im,jm)
370 integer ncid, error, id_var
372 print*,
'- READ IN EXTERNAL LANDMASK FILE: ',trim(merge_file)
373 error=nf90_open(merge_file,nf90_nowrite,ncid)
374 call netcdf_err(error,
'Open file '//trim(merge_file) )
376 error=nf90_inq_varid(ncid,
'land_frac', id_var)
377 call netcdf_err(error,
'inquire varid of land_frac')
378 error=nf90_get_var(ncid, id_var, land_frac)
379 call netcdf_err(error,
'inquire data of land_frac')
381 error=nf90_inq_varid(ncid,
'slmsk', id_var)
382 call netcdf_err(error,
'inquire varid of slmsk')
383 error=nf90_get_var(ncid, id_var, slm)
384 call netcdf_err(error,
'inquire data of slmsk')
386 error=nf90_inq_varid(ncid,
'lake_frac', id_var)
387 call netcdf_err(error,
'inquire varid of lake_frac')
388 error=nf90_get_var(ncid, id_var,
lake_frac)
389 call netcdf_err(error,
'inquire data of lake_frac')
391 error = nf90_close(ncid)
407 character(len=*),
intent(in) :: mdl_grid_file
409 integer,
intent(out) :: im, jm
411 integer ncid, error, id_dim, nx, ny
413 print*,
"- READ MDL GRID DIMENSIONS FROM= ", trim(mdl_grid_file)
415 error=nf90_open(mdl_grid_file, nf90_nowrite, ncid)
416 call netcdf_err(error,
'Opening file '//trim(mdl_grid_file) )
418 error=nf90_inq_dimid(ncid,
'nx', id_dim)
419 call netcdf_err(error,
'inquire dimension nx from file '// trim(mdl_grid_file) )
420 error=nf90_inquire_dimension(ncid, id_dim, len=nx)
421 call netcdf_err(error,
'inquire nx from file '//trim(mdl_grid_file) )
423 error=nf90_inq_dimid(ncid,
'ny', id_dim)
424 call netcdf_err(error,
'inquire dimension ny from file '// trim(mdl_grid_file) )
425 error=nf90_inquire_dimension(ncid, id_dim, len=ny)
426 call netcdf_err(error,
'inquire ny from file '//trim(mdl_grid_file) )
428 error=nf90_close(ncid)
433 print*,
"- MDL GRID DIMENSIONS ", im, jm
452 geolon, geolon_c, geolat, geolat_c, dx, dy, &
453 is_north_pole, is_south_pole)
461 character(len=*),
intent(in) :: mdl_grid_file
463 integer,
intent(in) :: im, jm
465 logical,
intent(out) :: is_north_pole(im,jm)
466 logical,
intent(out) :: is_south_pole(im,jm)
468 real,
intent(out) :: geolat(im,jm)
469 real,
intent(out) :: geolat_c(im+1,jm+1)
470 real,
intent(out) :: geolon(im,jm)
471 real,
intent(out) :: geolon_c(im+1,jm+1)
472 real,
intent(out) :: dx(im,jm), dy(im,jm)
475 integer :: ncid, error, id_var, nx, ny
476 integer :: i_south_pole,j_south_pole
477 integer :: i_north_pole,j_north_pole
479 real,
allocatable :: tmpvar(:,:)
484 allocate(tmpvar(nx+1,ny+1))
486 print*,
"- OPEN AND READ= ", trim(mdl_grid_file)
488 error=nf90_open(mdl_grid_file, nf90_nowrite, ncid)
489 call netcdf_err(error,
'Opening file '//trim(mdl_grid_file) )
491 error=nf90_inq_varid(ncid,
'x', id_var)
492 call netcdf_err(error,
'inquire varid of x from file ' // trim(mdl_grid_file))
493 error=nf90_get_var(ncid, id_var, tmpvar)
494 call netcdf_err(error,
'inquire data of x from file ' // trim(mdl_grid_file))
499 if(tmpvar(i,j) .GT. 360) tmpvar(i,j) = tmpvar(i,j) - 360
500 if(tmpvar(i,j) .LT. 0) tmpvar(i,j) = tmpvar(i,j) + 360
504 geolon(1:im,1:jm) = tmpvar(2:nx:2,2:ny:2)
505 geolon_c(1:im+1,1:jm+1) = tmpvar(1:nx+1:2,1:ny+1:2)
507 error=nf90_inq_varid(ncid,
'y', id_var)
508 call netcdf_err(error,
'inquire varid of y from file ' // trim(mdl_grid_file))
509 error=nf90_get_var(ncid, id_var, tmpvar)
510 call netcdf_err(error,
'inquire data of y from file ' // trim(mdl_grid_file))
512 geolat(1:im,1:jm) = tmpvar(2:nx:2,2:ny:2)
513 geolat_c(1:im+1,1:jm+1) = tmpvar(1:nx+1:2,1:ny+1:2)
515 call find_poles(tmpvar, nx, ny, i_north_pole, j_north_pole, &
516 i_south_pole, j_south_pole)
521 i_south_pole, j_south_pole, im, jm, is_north_pole, &
524 allocate(tmpvar(nx,ny))
526 error=nf90_inq_varid(ncid,
'area', id_var)
527 call netcdf_err(error,
'inquire varid of area from file ' // trim(mdl_grid_file))
528 error=nf90_get_var(ncid, id_var, tmpvar)
529 call netcdf_err(error,
'inquire data of area from file ' // trim(mdl_grid_file))
531 error = nf90_close(ncid)
535 dx(i,j) = sqrt(tmpvar(2*i-1,2*j-1)+tmpvar(2*i,2*j-1) &
536 + tmpvar(2*i-1,2*j )+tmpvar(2*i,2*j ))
558 integer,
intent(in) :: imn, jmn
559 integer*2,
intent(out) :: glob(imn,jmn)
561 integer :: ncid, error, id_dim, id_var, idim, jdim
563 print*,
"- OPEN AND READ ./topography.gmted2010.30s.nc" 565 error=nf90_open(
"./topography.gmted2010.30s.nc", &
567 call netcdf_err(error,
'Opening file topography.gmted2010.30s.nc' )
569 error=nf90_inq_dimid(ncid,
'idim', id_dim)
570 call netcdf_err(error,
'Inquire dimid of idim' )
572 error=nf90_inquire_dimension(ncid,id_dim,len=idim)
575 if (imn /= idim)
then 576 print*,
"FATAL ERROR: i-dimensions do not match." 579 error=nf90_inq_dimid(ncid,
'jdim', id_dim)
580 call netcdf_err(error,
'Inquire dimid of jdim' )
582 error=nf90_inquire_dimension(ncid,id_dim,len=jdim)
585 if (jmn /= jdim)
then 586 print*,
"FATAL ERROR: j-dimensions do not match." 589 error=nf90_inq_varid(ncid,
'topo', id_var)
590 call netcdf_err(error,
'Inquire varid of topo')
592 error=nf90_get_var(ncid, id_var, glob)
595 error = nf90_close(ncid)
597 print*,
"- MAX/MIN OF OROGRAPHY DATA ",maxval(glob),minval(glob)
617 integer,
intent(in) :: imn, jmn
619 integer(1),
intent(out) :: mask(imn,jmn)
621 integer :: ncid, id_var, id_dim, error, idim, jdim
623 print*,
"- OPEN AND READ ./landcover.umd.30s.nc" 625 error=nf90_open(
"./landcover.umd.30s.nc",nf90_nowrite,ncid)
626 call netcdf_err(error,
'Opening file landcover.umd.30s.nc' )
628 error=nf90_inq_dimid(ncid,
'idim', id_dim)
629 call netcdf_err(error,
'Inquire dimid of idim' )
631 error=nf90_inquire_dimension(ncid,id_dim,len=idim)
634 if (imn /= idim)
then 635 print*,
"FATAL ERROR: i-dimensions do not match." 638 error=nf90_inq_dimid(ncid,
'jdim', id_dim)
639 call netcdf_err(error,
'Inquire dimid of jdim' )
641 error=nf90_inquire_dimension(ncid,id_dim,len=jdim)
644 if (jmn /= jdim)
then 645 print*,
"FATAL ERROR: j-dimensions do not match." 648 error=nf90_inq_varid(ncid,
'land_mask', id_var)
649 call netcdf_err(error,
'Inquire varid of land_mask')
651 error=nf90_get_var(ncid, id_var, mask)
652 call netcdf_err(error,
'Inquire data of land_mask')
654 error = nf90_close(ncid)
674 integer,
intent(in) :: imn, jmn
675 integer,
intent(inout) :: zavg(imn,jmn)
676 integer,
intent(inout) :: zslm(imn,jmn)
678 integer :: i, j, error, ncid, id_var, id_dim, jramp
680 real(4),
allocatable :: gice(:,:)
685 print*,
"- OPEN/READ RAMP DATA ./topography.antarctica.ramp.30s.nc" 687 error=nf90_open(
"./topography.antarctica.ramp.30s.nc", &
689 call netcdf_err(error,
'Opening RAMP topo file' )
691 error=nf90_inq_dimid(ncid,
'jdim', id_dim)
692 call netcdf_err(error,
'Inquire dimid of jdim' )
694 error=nf90_inquire_dimension(ncid, id_dim, len=jramp)
697 allocate (gice(imn+1,jramp))
699 error=nf90_inq_varid(ncid,
'topo', id_var)
700 call netcdf_err(error,
'Inquire varid of RAMP topo')
702 error=nf90_get_var(ncid, id_var, gice)
703 call netcdf_err(error,
'Inquire data of RAMP topo')
705 error = nf90_close(ncid)
707 print*,
"- QC GLOBAL OROGRAPHY DATA WITH RAMP." 714 if ( gice(i,j) .gt. 0.)
then 715 zavg(i,j) = int( gice(i,j) + 0.5 )
subroutine, public transpose_mask(imn, jmn, mask)
Transpose the global landmask by flipping the poles and moving the starting longitude to Greenwich...
subroutine netcdf_err(err, string)
Check NetCDF error code and output the error message.
subroutine, public qc_orog_by_ramp(imn, jmn, zavg, zslm)
Quality control the global orography and landmask data over Antarctica using RAMP data...
subroutine, public read_mdl_grid_file(mdl_grid_file, im, jm, geolon, geolon_c, geolat, geolat_c, dx, dy, is_north_pole, is_south_pole)
Read the grid dimensions from the model 'grid' file.
Module containing utilities that read and write data.
subroutine, public read_global_orog(imn, jmn, glob)
Read input global 30-arc second orography data.
program lake_frac
This program computes lake fraction and depth numbers for FV3 cubed sphere grid cells, from a high resolution lat/lon data set.
subroutine, public read_mdl_dims(mdl_grid_file, im, jm)
Read the grid dimensions from the model 'grid' file.
subroutine, public find_poles(geolat, nx, ny, i_north_pole, j_north_pole, i_south_pole, j_south_pole)
Find the point on the model grid tile closest to the north and south pole.
subroutine, public find_nearest_pole_points(i_north_pole, j_north_pole, i_south_pole, j_south_pole, im, jm, is_north_pole, is_south_pole)
Find the point on the model grid tile closest to the north and south pole.
subroutine, public read_global_mask(imn, jmn, mask)
Read input global 30-arc second land mask data.
Module containing utilites used by the orog program.
subroutine, public write_netcdf(im, jm, slm, land_frac, oro, hprime, ntiles, tile, geolon, geolat, lon, lat)
Write out orography file in netcdf format.
subroutine, public transpose_orog(imn, jmn, glob)
Transpose the global orography data by flipping the poles and moving the starting longitude to Greenw...
subroutine, public read_mask(merge_file, slm, land_frac, lake_frac, im, jm)
Read the land mask file.
subroutine, public write_mask_netcdf(im, jm, slm, land_frac, ntiles, tile, geolon, geolat)
Write the land mask file.