-
Notifications
You must be signed in to change notification settings - Fork 111
/
Copy pathsfc_input_data.F90
3351 lines (2666 loc) · 140 KB
/
sfc_input_data.F90
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
module sfc_input_data
!> @file
!! @brief Read atmospheric and surface data from GRIB2, NEMSIO and NetCDF files.
!! @author George Gayno NCEP/EMC
!> Read atmospheric, surface and nst data on the input grid.
!! Supported formats include fv3 tiled 'restart' files, fv3 tiled
!! 'history' files, fv3 gaussian history files, spectral gfs
!! gaussian nemsio files, and spectral gfs sigio/sfcio files.
!!
!! Public variables are defined below: "input" indicates field
!! associated with the input grid.
!!
!! @author George Gayno NCEP/EMC
use esmf
use netcdf
use nemsio_module
use program_setup, only : data_dir_input_grid, &
sfc_files_input_grid, &
grib2_file_input_grid, &
convert_nst, &
orog_dir_input_grid, &
orog_files_input_grid, &
input_type, &
get_var_cond, &
geogrid_file_input_grid, &
external_model, &
vgfrc_from_climo, &
minmax_vgfrc_from_climo, &
lai_from_climo,&
read_from_input
use model_grid, only : input_grid, &
i_input, j_input, &
ip1_input, jp1_input, &
num_tiles_input_grid
use atm_input_data, only : terrain_input_grid
use utilities, only : error_handler, &
netcdf_err, &
handle_grib_error, &
to_upper, &
check_soilt, &
check_cnwat
! Fields associated with the land-surface model.
integer, public :: veg_type_landice_input = 15 !< NOAH land ice option
!< defined at this veg type.
!< Default is igbp.
real :: ICET_DEFAULT = 265.0 !< Default value of soil and skin
!< temperature (K) over ice.
type(esmf_field), public :: canopy_mc_input_grid !< canopy moist content
type(esmf_field), public :: f10m_input_grid !< log((z0+10)*1/z0)
type(esmf_field), public :: ffmm_input_grid !< log((z0+z1)*1/z0)
!! See sfc_diff.f for details.
type(esmf_field), public :: landsea_mask_input_grid !< land sea mask;
!! 0-water, 1-land, 2-ice
type(esmf_field), public :: q2m_input_grid !< 2-m spec hum
type(esmf_field), public :: seaice_depth_input_grid !< sea ice depth
type(esmf_field), public :: seaice_fract_input_grid !< sea ice fraction
type(esmf_field), public :: seaice_skin_temp_input_grid !< sea ice skin temp
type(esmf_field), public :: skin_temp_input_grid !< skin temp/sst
type(esmf_field), public :: snow_depth_input_grid !< snow dpeth
type(esmf_field), public :: snow_liq_equiv_input_grid !< snow liq equiv depth
type(esmf_field), public :: soil_temp_input_grid !< 3-d soil temp
type(esmf_field), public :: soil_type_input_grid !< soil type
type(esmf_field), public :: soilm_liq_input_grid !< 3-d liquid soil moisture
type(esmf_field), public :: soilm_tot_input_grid !< 3-d total soil moisture
type(esmf_field), public :: srflag_input_grid !< snow/rain flag
type(esmf_field), public :: t2m_input_grid !< 2-m temperature
type(esmf_field), public :: tprcp_input_grid !< precip
type(esmf_field), public :: ustar_input_grid !< fric velocity
type(esmf_field), public :: veg_type_input_grid !< vegetation type
type(esmf_field), public :: z0_input_grid !< roughness length
type(esmf_field), public :: veg_greenness_input_grid !< vegetation fraction
type(esmf_field), public :: lai_input_grid !< leaf area index
type(esmf_field), public :: max_veg_greenness_input_grid !< shdmax
type(esmf_field), public :: min_veg_greenness_input_grid !< shdmin
integer, public :: lsoil_input=4 !< number of soil layers, no longer hardwired to allow
!! for 7 layers of soil for the RUC LSM
public :: read_input_sfc_data
public :: cleanup_input_sfc_data
public :: init_sfc_esmf_fields
contains
!> Driver to read input grid surface data.
!!
!! @param[in] localpet ESMF local persistent execution thread
!! @author George Gayno NCEP/EMC
subroutine read_input_sfc_data(localpet)
implicit none
integer, intent(in) :: localpet
call init_sfc_esmf_fields()
!-------------------------------------------------------------------------------
! Read the tiled 'warm' restart files.
!-------------------------------------------------------------------------------
if (trim(input_type) == "restart") then
call read_input_sfc_restart_file(localpet)
!-------------------------------------------------------------------------------
! Read the tiled or gaussian history files in netcdf format.
!-------------------------------------------------------------------------------
elseif (trim(input_type) == "history" .or. trim(input_type) == &
"gaussian_netcdf") then
call read_input_sfc_netcdf_file(localpet)
!-------------------------------------------------------------------------------
! Read the gaussian history files in nemsio format.
!-------------------------------------------------------------------------------
elseif (trim(input_type) == "gaussian_nemsio") then
call read_input_sfc_gaussian_nemsio_file(localpet)
!-------------------------------------------------------------------------------
! Read the spectral gfs gaussian history files in nemsio format.
!-------------------------------------------------------------------------------
elseif (trim(input_type) == "gfs_gaussian_nemsio") then
call read_input_sfc_gfs_gaussian_nemsio_file(localpet)
!-------------------------------------------------------------------------------
! Read the spectral gfs gaussian history files in sfcio format.
!-------------------------------------------------------------------------------
elseif (trim(input_type) == "gfs_sigio") then
call read_input_sfc_gfs_sfcio_file(localpet)
!-------------------------------------------------------------------------------
! Read fv3gfs surface data in grib2 format.
!-------------------------------------------------------------------------------
elseif (trim(input_type) == "grib2") then
call read_input_sfc_grib2_file(localpet)
endif
end subroutine read_input_sfc_data
!> Read input grid surface data from a spectral gfs gaussian sfcio
!! file.
!!
!! @note Prior to July 19, 2017.
!!
!! @param[in] localpet ESMF local persistent execution thread
!! @author George Gayno NCEP/EMC
subroutine read_input_sfc_gfs_sfcio_file(localpet)
use sfcio_module
implicit none
integer, intent(in) :: localpet
character(len=300) :: the_file
integer(sfcio_intkind) :: iret
integer :: rc
real(esmf_kind_r8), allocatable :: dummy2d(:,:)
real(esmf_kind_r8), allocatable :: dummy3d(:,:,:)
type(sfcio_head) :: sfchead
type(sfcio_dbta) :: sfcdata
the_file = trim(data_dir_input_grid) // "/" // trim(sfc_files_input_grid(1))
print*,"- READ SURFACE DATA IN SFCIO FORMAT."
print*,"- OPEN AND READ: ",trim(the_file)
call sfcio_sropen(23, trim(the_file), iret)
if (iret /= 0) then
rc=iret
call error_handler("OPENING FILE", rc)
endif
call sfcio_srhead(23, sfchead, iret)
if (iret /= 0) then
rc=iret
call error_handler("READING HEADER", rc)
endif
if (localpet == 0) then
call sfcio_aldbta(sfchead, sfcdata, iret)
if (iret /= 0) then
rc=iret
call error_handler("ALLOCATING DATA.", rc)
endif
call sfcio_srdbta(23, sfchead, sfcdata, iret)
if (iret /= 0) then
rc=iret
call error_handler("READING DATA.", rc)
endif
allocate(dummy2d(i_input,j_input))
allocate(dummy3d(i_input,j_input,lsoil_input))
else
allocate(dummy2d(0,0))
allocate(dummy3d(0,0,0))
endif
if (localpet == 0) dummy2d = sfcdata%slmsk
print*,"- CALL FieldScatter FOR INPUT LANDSEA MASK."
call ESMF_FieldScatter(landsea_mask_input_grid, dummy2d, rootpet=0, rc=rc)
if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) &
call error_handler("IN FieldScatter", rc)
if (localpet == 0) dummy2d = sfcdata%zorl
print*,"- CALL FieldScatter FOR INPUT Z0."
call ESMF_FieldScatter(z0_input_grid, dummy2d, rootpet=0, rc=rc)
if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) &
call error_handler("IN FieldScatter", rc)
if (localpet == 0) dummy2d = nint(sfcdata%vtype)
print*,"- CALL FieldScatter FOR INPUT VEG TYPE."
call ESMF_FieldScatter(veg_type_input_grid, dummy2d, rootpet=0, rc=rc)
if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) &
call error_handler("IN FieldScatter", rc)
! Prior to July, 2017, gfs used zobler soil types. '13' indicates permanent land ice.
veg_type_landice_input = 13
if (localpet == 0) dummy2d = sfcdata%canopy
print*,"- CALL FieldScatter FOR INPUT CANOPY MC."
call ESMF_FieldScatter(canopy_mc_input_grid, dummy2d, rootpet=0, rc=rc)
if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) &
call error_handler("IN FieldScatter", rc)
if (localpet == 0) dummy2d = sfcdata%fice
print*,"- CALL FieldScatter FOR INPUT ICE FRACTION."
call ESMF_FieldScatter(seaice_fract_input_grid, dummy2d, rootpet=0, rc=rc)
if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) &
call error_handler("IN FieldScatter", rc)
if (localpet == 0) dummy2d = sfcdata%hice
print*,"- CALL FieldScatter FOR INPUT ICE DEPTH."
call ESMF_FieldScatter(seaice_depth_input_grid, dummy2d, rootpet=0, rc=rc)
if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) &
call error_handler("IN FieldScatter", rc)
if (localpet == 0) dummy2d = sfcdata%tisfc
print*,"- CALL FieldScatter FOR INPUT ICE SKIN TEMP."
call ESMF_FieldScatter(seaice_skin_temp_input_grid, dummy2d, rootpet=0, rc=rc)
if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) &
call error_handler("IN FieldScatter", rc)
if (localpet == 0) dummy2d = sfcdata%snwdph ! mm (expected by program)
print*,"- CALL FieldScatter FOR INPUT SNOW DEPTH."
call ESMF_FieldScatter(snow_depth_input_grid, dummy2d, rootpet=0, rc=rc)
if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) &
call error_handler("IN FieldScatter", rc)
if (localpet == 0) dummy2d = sfcdata%sheleg
print*,"- CALL FieldScatter FOR INPUT SNOW LIQUID EQUIV."
call ESMF_FieldScatter(snow_liq_equiv_input_grid, dummy2d, rootpet=0, rc=rc)
if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) &
call error_handler("IN FieldScatter", rc)
if (localpet == 0) dummy2d = sfcdata%t2m
print*,"- CALL FieldScatter FOR INPUT T2M."
call ESMF_FieldScatter(t2m_input_grid, dummy2d, rootpet=0, rc=rc)
if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) &
call error_handler("IN FieldScatter", rc)
if (localpet == 0) dummy2d = sfcdata%q2m
print*,"- CALL FieldScatter FOR INPUT Q2M."
call ESMF_FieldScatter(q2m_input_grid, dummy2d, rootpet=0, rc=rc)
if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) &
call error_handler("IN FieldScatter", rc)
if (localpet == 0) dummy2d = sfcdata%tprcp
print*,"- CALL FieldScatter FOR INPUT TPRCP."
call ESMF_FieldScatter(tprcp_input_grid, dummy2d, rootpet=0, rc=rc)
if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) &
call error_handler("IN FieldScatter", rc)
if (localpet == 0) dummy2d = sfcdata%f10m
print*,"- CALL FieldScatter FOR INPUT F10M."
call ESMF_FieldScatter(f10m_input_grid, dummy2d, rootpet=0, rc=rc)
if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) &
call error_handler("IN FieldScatter", rc)
if (localpet == 0) dummy2d = sfcdata%uustar
print*,"- CALL FieldScatter FOR INPUT USTAR."
call ESMF_FieldScatter(ustar_input_grid, dummy2d, rootpet=0, rc=rc)
if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) &
call error_handler("IN FieldScatter", rc)
if (localpet == 0) dummy2d = sfcdata%ffmm
print*,"- CALL FieldScatter FOR INPUT FFMM."
call ESMF_FieldScatter(ffmm_input_grid, dummy2d, rootpet=0, rc=rc)
if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) &
call error_handler("IN FieldScatter", rc)
if (localpet == 0) dummy2d = sfcdata%srflag
print*,"- CALL FieldScatter FOR INPUT SRFLAG."
call ESMF_FieldScatter(srflag_input_grid, dummy2d, rootpet=0, rc=rc)
if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) &
call error_handler("IN FieldScatter", rc)
if (localpet == 0) dummy2d = sfcdata%tsea
print*,"- CALL FieldScatter FOR INPUT SKIN TEMP."
call ESMF_FieldScatter(skin_temp_input_grid, dummy2d, rootpet=0, rc=rc)
if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) &
call error_handler("IN FieldScatter", rc)
if (localpet == 0) dummy2d = nint(sfcdata%stype)
print*,"- CALL FieldScatter FOR INPUT SOIL TYPE."
call ESMF_FieldScatter(soil_type_input_grid, dummy2d, rootpet=0, rc=rc)
if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) &
call error_handler("IN FieldScatter", rc)
if (localpet == 0) dummy2d = sfcdata%orog
print*,"- CALL FieldScatter FOR INPUT TERRAIN."
call ESMF_FieldScatter(terrain_input_grid, dummy2d, rootpet=0, rc=rc)
if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) &
call error_handler("IN FieldScatter", rc)
if (localpet == 0) dummy3d = sfcdata%slc
print*,"- CALL FieldScatter FOR INPUT LIQUID SOIL MOISTURE."
call ESMF_FieldScatter(soilm_liq_input_grid, dummy3d, rootpet=0, rc=rc)
if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) &
call error_handler("IN FieldScatter", rc)
if (localpet == 0) dummy3d = sfcdata%smc
print*,"- CALL FieldScatter FOR INPUT TOTAL SOIL MOISTURE."
call ESMF_FieldScatter(soilm_tot_input_grid, dummy3d, rootpet=0, rc=rc)
if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) &
call error_handler("IN FieldScatter", rc)
if (localpet == 0) dummy3d = sfcdata%stc
print*,"- CALL FieldScatter FOR INPUT SOIL TEMPERATURE."
call ESMF_FieldScatter(soil_temp_input_grid, dummy3d, rootpet=0, rc=rc)
if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) &
call error_handler("IN FieldScatter", rc)
deallocate(dummy2d, dummy3d)
call sfcio_axdbta(sfcdata, iret)
call sfcio_sclose(23, iret)
end subroutine read_input_sfc_gfs_sfcio_file
!> Read input grid surface data from a spectral gfs gaussian nemsio
!! file.
!!
!! @note Format used by gfs starting July 19, 2017.
!!
!! @param[in] localpet ESMF local persistent execution thread
!! @author George Gayno NCEP/EMC
subroutine read_input_sfc_gfs_gaussian_nemsio_file(localpet)
implicit none
integer, intent(in) :: localpet
character(len=300) :: the_file
integer :: rc
real(nemsio_realkind), allocatable :: dummy(:)
real(esmf_kind_r8), allocatable :: dummy2d(:,:)
real(esmf_kind_r8), allocatable :: dummy3d(:,:,:)
type(nemsio_gfile) :: gfile
the_file = trim(data_dir_input_grid) // "/" // trim(sfc_files_input_grid(1))
if (localpet == 0) then
allocate(dummy3d(i_input,j_input,lsoil_input))
allocate(dummy2d(i_input,j_input))
allocate(dummy(i_input*j_input))
print*,"- OPEN FILE ", trim(the_file)
call nemsio_open(gfile, the_file, "read", iret=rc)
if (rc /= 0) call error_handler("OPENING FILE.", rc)
else
allocate(dummy3d(0,0,0))
allocate(dummy2d(0,0))
allocate(dummy(0))
endif
if (localpet == 0) then
print*,"- READ TERRAIN."
call nemsio_readrecv(gfile, "orog", "sfc", 1, dummy, 0, iret=rc)
if (rc /= 0) call error_handler("READING TERRAIN.", rc)
dummy2d = reshape(dummy, (/i_input,j_input/))
print*,'orog ',maxval(dummy2d),minval(dummy2d)
endif
print*,"- CALL FieldScatter FOR INPUT TERRAIN."
call ESMF_FieldScatter(terrain_input_grid, dummy2d, rootpet=0, rc=rc)
if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) &
call error_handler("IN FieldScatter", rc)
if (localpet == 0) then
print*,"- READ LANDSEA MASK."
call nemsio_readrecv(gfile, "land", "sfc", 1, dummy, 0, iret=rc)
if (rc /= 0) call error_handler("READING LANDSEA MASK.", rc)
dummy2d = reshape(dummy, (/i_input,j_input/))
print*,'landmask ',maxval(dummy2d),minval(dummy2d)
endif
print*,"- CALL FieldScatter FOR INPUT LANDSEA MASK."
call ESMF_FieldScatter(landsea_mask_input_grid, dummy2d, rootpet=0, rc=rc)
if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) &
call error_handler("IN FieldScatter", rc)
if (localpet == 0) then
print*,"- READ SEAICE FRACTION."
call nemsio_readrecv(gfile, "icec", "sfc", 1, dummy, 0, iret=rc)
if (rc /= 0) call error_handler("READING SEAICE FRACTION.", rc)
dummy2d = reshape(dummy, (/i_input,j_input/))
print*,'icec ',maxval(dummy2d),minval(dummy2d)
endif
print*,"- CALL FieldScatter FOR INPUT GRID SEAICE FRACTION."
call ESMF_FieldScatter(seaice_fract_input_grid, dummy2d, rootpet=0, rc=rc)
if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) &
call error_handler("IN FieldScatter", rc)
if (localpet == 0) then
print*,"- READ SEAICE DEPTH."
call nemsio_readrecv(gfile, "icetk", "sfc", 1, dummy, 0, iret=rc)
if (rc /= 0) call error_handler("READING SEAICE DEPTH.", rc)
dummy2d = reshape(dummy, (/i_input,j_input/))
print*,'icetk ',maxval(dummy2d),minval(dummy2d)
endif
print*,"- CALL FieldScatter FOR INPUT GRID SEAICE DEPTH."
call ESMF_FieldScatter(seaice_depth_input_grid, dummy2d, rootpet=0, rc=rc)
if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) &
call error_handler("IN FieldScatter", rc)
if (localpet == 0) then
print*,"- READ SEAICE SKIN TEMPERATURE."
call nemsio_readrecv(gfile, "tisfc", "sfc", 1, dummy, 0, iret=rc)
if (rc /= 0) call error_handler("READING SEAICE SKIN TEMP.", rc)
dummy2d = reshape(dummy, (/i_input,j_input/))
print*,'ti ',maxval(dummy2d),minval(dummy2d)
endif
print*,"- CALL FieldScatter FOR INPUT GRID SEAICE SKIN TEMPERATURE."
call ESMF_FieldScatter(seaice_skin_temp_input_grid, dummy2d, rootpet=0, rc=rc)
if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) &
call error_handler("IN FieldScatter", rc)
if (localpet == 0) then
print*,"- READ SNOW LIQUID EQUIVALENT."
call nemsio_readrecv(gfile, "weasd", "sfc", 1, dummy, 0, iret=rc)
if (rc /= 0) call error_handler("READING SNOW LIQUID EQUIVALENT.", rc)
dummy2d = reshape(dummy, (/i_input,j_input/))
print*,'weasd ',maxval(dummy2d),minval(dummy2d)
endif
print*,"- CALL FieldScatter FOR INPUT GRID SNOW LIQUID EQUIVALENT."
call ESMF_FieldScatter(snow_liq_equiv_input_grid, dummy2d, rootpet=0, rc=rc)
if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) &
call error_handler("IN FieldScatter", rc)
if (localpet == 0) then
print*,"- READ SNOW DEPTH."
call nemsio_readrecv(gfile, "snod", "sfc", 1, dummy, 0, iret=rc)
if (rc /= 0) call error_handler("READING SNOW DEPTH.", rc)
dummy2d = reshape(dummy, (/i_input,j_input/))
print*,'snod ',maxval(dummy2d),minval(dummy2d)
endif
print*,"- CALL FieldScatter FOR INPUT GRID SNOW DEPTH."
call ESMF_FieldScatter(snow_depth_input_grid, dummy2d, rootpet=0, rc=rc)
if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) &
call error_handler("IN FieldScatter", rc)
if (localpet == 0) then
print*,"- READ VEG TYPE."
call nemsio_readrecv(gfile, "vtype", "sfc", 1, dummy, 0, iret=rc)
if (rc /= 0) call error_handler("READING VEG TYPE", rc)
dummy2d = reshape(dummy, (/i_input,j_input/))
print*,'vtype ',maxval(dummy2d),minval(dummy2d)
endif
print*,"- CALL FieldScatter FOR INPUT GRID VEG TYPE."
call ESMF_FieldScatter(veg_type_input_grid, dummy2d, rootpet=0, rc=rc)
if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) &
call error_handler("IN FieldScatter", rc)
if (localpet == 0) then
print*,"- READ SOIL TYPE."
call nemsio_readrecv(gfile, "sotyp", "sfc", 1, dummy, 0, iret=rc)
if (rc /= 0) call error_handler("READING SOIL TYPE.", rc)
dummy2d = reshape(dummy, (/i_input,j_input/))
print*,'sotype ',maxval(dummy2d),minval(dummy2d)
endif
print*,"- CALL FieldScatter FOR INPUT GRID SOIL TYPE."
call ESMF_FieldScatter(soil_type_input_grid, dummy2d, rootpet=0, rc=rc)
if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) &
call error_handler("IN FieldScatter", rc)
if (localpet == 0) then
print*,"- READ T2M."
call nemsio_readrecv(gfile, "tmp", "2 m above gnd", 1, dummy, 0, iret=rc)
if (rc /= 0) call error_handler("READING T2M.", rc)
dummy2d = reshape(dummy, (/i_input,j_input/))
print*,'t2m ',maxval(dummy2d),minval(dummy2d)
endif
print*,"- CALL FieldScatter FOR INPUT GRID T2M."
call ESMF_FieldScatter(t2m_input_grid, dummy2d, rootpet=0, rc=rc)
if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) &
call error_handler("IN FieldScatter", rc)
if (localpet == 0) then
print*,"- READ Q2M."
call nemsio_readrecv(gfile, "spfh", "2 m above gnd", 1, dummy, 0, iret=rc)
if (rc /= 0) call error_handler("READING Q2M.", rc)
dummy2d = reshape(dummy, (/i_input,j_input/))
print*,'q2m ',maxval(dummy2d),minval(dummy2d)
endif
print*,"- CALL FieldScatter FOR INPUT GRID Q2M."
call ESMF_FieldScatter(q2m_input_grid, dummy2d, rootpet=0, rc=rc)
if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) &
call error_handler("IN FieldScatter", rc)
if (localpet == 0) then
print*,"- READ TPRCP."
call nemsio_readrecv(gfile, "tprcp", "sfc", 1, dummy, 0, iret=rc)
if (rc /= 0) call error_handler("READING TPRCP.", rc)
dummy2d = reshape(dummy, (/i_input,j_input/))
print*,'tprcp ',maxval(dummy2d),minval(dummy2d)
endif
print*,"- CALL FieldScatter FOR INPUT GRID TPRCP."
call ESMF_FieldScatter(tprcp_input_grid, dummy2d, rootpet=0, rc=rc)
if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) &
call error_handler("IN FieldScatter", rc)
if (localpet == 0) then
print*,"- READ FFMM."
call nemsio_readrecv(gfile, "ffmm", "sfc", 1, dummy, 0, iret=rc)
if (rc /= 0) call error_handler("READING FFMM.", rc)
dummy2d = reshape(dummy, (/i_input,j_input/))
print*,'ffmm ',maxval(dummy2d),minval(dummy2d)
endif
print*,"- CALL FieldScatter FOR INPUT GRID FFMM"
call ESMF_FieldScatter(ffmm_input_grid, dummy2d, rootpet=0, rc=rc)
if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) &
call error_handler("IN FieldScatter", rc)
if (localpet == 0) then
print*,"- READ USTAR."
call nemsio_readrecv(gfile, "fricv", "sfc", 1, dummy, 0, iret=rc)
if (rc /= 0) call error_handler("READING USTAR.", rc)
dummy2d = reshape(dummy, (/i_input,j_input/))
print*,'fricv ',maxval(dummy2d),minval(dummy2d)
endif
print*,"- CALL FieldScatter FOR INPUT GRID USTAR"
call ESMF_FieldScatter(ustar_input_grid, dummy2d, rootpet=0, rc=rc)
if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) &
call error_handler("IN FieldScatter", rc)
if (localpet == 0) dummy2d = 0.0
print*,"- CALL FieldScatter FOR INPUT GRID SRFLAG"
call ESMF_FieldScatter(srflag_input_grid, dummy2d, rootpet=0, rc=rc)
if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) &
call error_handler("IN FieldScatter", rc)
if (localpet == 0) then
print*,"- READ SKIN TEMPERATURE."
call nemsio_readrecv(gfile, "tmp", "sfc", 1, dummy, 0, iret=rc)
if (rc /= 0) call error_handler("READING SKIN TEMPERATURE.", rc)
dummy2d = reshape(dummy, (/i_input,j_input/))
print*,'tmp ',maxval(dummy2d),minval(dummy2d)
endif
print*,"- CALL FieldScatter FOR INPUT GRID SKIN TEMPERATURE"
call ESMF_FieldScatter(skin_temp_input_grid, dummy2d, rootpet=0, rc=rc)
if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) &
call error_handler("IN FieldScatter", rc)
if (localpet == 0) then
print*,"- READ F10M."
call nemsio_readrecv(gfile, "f10m", "10 m above gnd", 1, dummy, 0, iret=rc)
if (rc /= 0) call error_handler("READING F10M.", rc)
dummy2d = reshape(dummy, (/i_input,j_input/))
print*,'f10m ',maxval(dummy2d),minval(dummy2d)
endif
print*,"- CALL FieldScatter FOR INPUT GRID F10M."
call ESMF_FieldScatter(f10m_input_grid, dummy2d, rootpet=0, rc=rc)
if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) &
call error_handler("IN FieldScatter", rc)
if (localpet == 0) then
print*,"- READ CANOPY MOISTURE CONTENT."
call nemsio_readrecv(gfile, "cnwat", "sfc", 1, dummy, 0, iret=rc)
if (rc /= 0) call error_handler("READING CANOPY MOISTURE CONTENT.", rc)
dummy2d = reshape(dummy, (/i_input,j_input/))
print*,'cnwat ',maxval(dummy2d),minval(dummy2d)
endif
print*,"- CALL FieldScatter FOR INPUT GRID CANOPY MOISTURE CONTENT."
call ESMF_FieldScatter(canopy_mc_input_grid, dummy2d, rootpet=0, rc=rc)
if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) &
call error_handler("IN FieldScatter", rc)
if (localpet == 0) then
print*,"- READ Z0."
call nemsio_readrecv(gfile, "sfcr", "sfc", 1, dummy, 0, iret=rc)
if (rc /= 0) call error_handler("READING Z0.", rc)
dummy2d = reshape(dummy, (/i_input,j_input/))
print*,'sfcr ',maxval(dummy2d),minval(dummy2d)
endif
print*,"- CALL FieldScatter FOR INPUT GRID Z0."
call ESMF_FieldScatter(z0_input_grid, dummy2d, rootpet=0, rc=rc)
if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) &
call error_handler("IN FieldScatter", rc)
deallocate(dummy2d)
if (localpet == 0) then
print*,"- READ LIQUID SOIL MOISTURE."
call nemsio_readrecv(gfile, "slc", "soil layer", 1, dummy, 0, iret=rc)
if (rc /= 0) call error_handler("READING LAYER 1 LIQUID SOIL MOIST.", rc)
dummy3d(:,:,1) = reshape(dummy, (/i_input,j_input/))
call nemsio_readrecv(gfile, "slc", "soil layer", 2, dummy, 0, iret=rc)
if (rc /= 0) call error_handler("READING LAYER 2 LIQUID SOIL MOIST.", rc)
dummy3d(:,:,2) = reshape(dummy, (/i_input,j_input/))
call nemsio_readrecv(gfile, "slc", "soil layer", 3, dummy, 0, iret=rc)
if (rc /= 0) call error_handler("READING LAYER 3 LIQUID SOIL MOIST.", rc)
dummy3d(:,:,3) = reshape(dummy, (/i_input,j_input/))
call nemsio_readrecv(gfile, "slc", "soil layer", 4, dummy, 0, iret=rc)
if (rc /= 0) call error_handler("READING LAYER 4 LIQUID SOIL MOIST.", rc)
dummy3d(:,:,4) = reshape(dummy, (/i_input,j_input/))
print*,'slc ',maxval(dummy3d),minval(dummy3d)
endif
print*,"- CALL FieldScatter FOR INPUT LIQUID SOIL MOISTURE."
call ESMF_FieldScatter(soilm_liq_input_grid, dummy3d, rootpet=0, rc=rc)
if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) &
call error_handler("IN FieldScatter", rc)
if (localpet == 0) then
print*,"- READ TOTAL SOIL MOISTURE."
call nemsio_readrecv(gfile, "smc", "soil layer", 1, dummy, 0, iret=rc)
if (rc /= 0) call error_handler("READING LAYER 1 TOTAL SOIL MOIST.", rc)
dummy3d(:,:,1) = reshape(dummy, (/i_input,j_input/))
call nemsio_readrecv(gfile, "smc", "soil layer", 2, dummy, 0, iret=rc)
if (rc /= 0) call error_handler("READING LAYER 2 TOTAL SOIL MOIST.", rc)
dummy3d(:,:,2) = reshape(dummy, (/i_input,j_input/))
call nemsio_readrecv(gfile, "smc", "soil layer", 3, dummy, 0, iret=rc)
if (rc /= 0) call error_handler("READING LAYER 3 TOTAL SOIL MOIST.", rc)
dummy3d(:,:,3) = reshape(dummy, (/i_input,j_input/))
call nemsio_readrecv(gfile, "smc", "soil layer", 4, dummy, 0, iret=rc)
if (rc /= 0) call error_handler("READING LAYER 4 TOTAL SOIL MOIST.", rc)
dummy3d(:,:,4) = reshape(dummy, (/i_input,j_input/))
print*,'smc ',maxval(dummy3d),minval(dummy3d)
endif
print*,"- CALL FieldScatter FOR INPUT TOTAL SOIL MOISTURE."
call ESMF_FieldScatter(soilm_tot_input_grid, dummy3d, rootpet=0, rc=rc)
if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) &
call error_handler("IN FieldScatter", rc)
if (localpet == 0) then
print*,"- READ SOIL TEMPERATURE."
call nemsio_readrecv(gfile, "stc", "soil layer", 1, dummy, 0, iret=rc)
if (rc /= 0) call error_handler("READING LAYER 1 SOIL TEMP.", rc)
dummy3d(:,:,1) = reshape(dummy, (/i_input,j_input/))
call nemsio_readrecv(gfile, "stc", "soil layer", 2, dummy, 0, iret=rc)
if (rc /= 0) call error_handler("READING LAYER 2 SOIL TEMP.", rc)
dummy3d(:,:,2) = reshape(dummy, (/i_input,j_input/))
call nemsio_readrecv(gfile, "stc", "soil layer", 3, dummy, 0, iret=rc)
if (rc /= 0) call error_handler("READING LAYER 3 SOIL TEMP.", rc)
dummy3d(:,:,3) = reshape(dummy, (/i_input,j_input/))
call nemsio_readrecv(gfile, "stc", "soil layer", 4, dummy, 0, iret=rc)
if (rc /= 0) call error_handler("READING LAYER 4 SOIL TEMP.", rc)
dummy3d(:,:,4) = reshape(dummy, (/i_input,j_input/))
print*,'stc ',maxval(dummy3d),minval(dummy3d)
endif
print*,"- CALL FieldScatter FOR INPUT SOIL TEMPERATURE."
call ESMF_FieldScatter(soil_temp_input_grid, dummy3d, rootpet=0, rc=rc)
if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) &
call error_handler("IN FieldScatter", rc)
deallocate(dummy3d, dummy)
if (localpet == 0) call nemsio_close(gfile)
end subroutine read_input_sfc_gfs_gaussian_nemsio_file
!> Read input grid surface data from an fv3 gaussian nemsio file.
!!
!! @param[in] localpet ESMF local persistent execution thread
!! @author George Gayno NCEP/EMC
subroutine read_input_sfc_gaussian_nemsio_file(localpet)
implicit none
integer, intent(in) :: localpet
character(len=250) :: the_file
integer :: rc
real(nemsio_realkind), allocatable :: dummy(:)
real(esmf_kind_r8), allocatable :: dummy2d(:,:)
real(esmf_kind_r8), allocatable :: dummy3d(:,:,:)
type(nemsio_gfile) :: gfile
the_file = trim(data_dir_input_grid) // "/" // trim(sfc_files_input_grid(1))
if (localpet == 0) then
allocate(dummy3d(i_input,j_input,lsoil_input))
allocate(dummy2d(i_input,j_input))
allocate(dummy(i_input*j_input))
print*,"- OPEN FILE ", trim(the_file)
call nemsio_open(gfile, the_file, "read", iret=rc)
if (rc /= 0) call error_handler("OPENING FILE.", rc)
else
allocate(dummy3d(0,0,0))
allocate(dummy2d(0,0))
allocate(dummy(0))
endif
if (localpet == 0) then
print*,"- READ TERRAIN."
call nemsio_readrecv(gfile, "orog", "sfc", 1, dummy, 0, iret=rc)
if (rc /= 0) call error_handler("READING TERRAIN.", rc)
dummy2d = reshape(dummy, (/i_input,j_input/))
print*,'orog ',maxval(dummy2d),minval(dummy2d)
endif
print*,"- CALL FieldScatter FOR INPUT TERRAIN."
call ESMF_FieldScatter(terrain_input_grid, dummy2d, rootpet=0, rc=rc)
if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) &
call error_handler("IN FieldScatter", rc)
if (localpet == 0) then
print*,"- READ LANDSEA MASK."
call nemsio_readrecv(gfile, "land", "sfc", 1, dummy, 0, iret=rc)
if (rc /= 0) call error_handler("READING LANDSEA MASK.", rc)
dummy2d = reshape(dummy, (/i_input,j_input/))
print*,'landmask ',maxval(dummy2d),minval(dummy2d)
endif
print*,"- CALL FieldScatter FOR INPUT LANDSEA MASK."
call ESMF_FieldScatter(landsea_mask_input_grid, dummy2d, rootpet=0, rc=rc)
if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) &
call error_handler("IN FieldScatter", rc)
if (localpet == 0) then
print*,"- READ SEAICE FRACTION."
call nemsio_readrecv(gfile, "icec", "sfc", 1, dummy, 0, iret=rc)
if (rc /= 0) call error_handler("READING SEAICE FRACTION.", rc)
dummy2d = reshape(dummy, (/i_input,j_input/))
print*,'icec ',maxval(dummy2d),minval(dummy2d)
endif
print*,"- CALL FieldScatter FOR INPUT GRID SEAICE FRACTION."
call ESMF_FieldScatter(seaice_fract_input_grid, dummy2d, rootpet=0, rc=rc)
if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) &
call error_handler("IN FieldScatter", rc)
if (localpet == 0) then
print*,"- READ SEAICE DEPTH."
call nemsio_readrecv(gfile, "icetk", "sfc", 1, dummy, 0, iret=rc)
if (rc /= 0) call error_handler("READING SEAICE DEPTH.", rc)
dummy2d = reshape(dummy, (/i_input,j_input/))
print*,'icetk ',maxval(dummy2d),minval(dummy2d)
endif
print*,"- CALL FieldScatter FOR INPUT GRID SEAICE DEPTH."
call ESMF_FieldScatter(seaice_depth_input_grid, dummy2d, rootpet=0, rc=rc)
if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) &
call error_handler("IN FieldScatter", rc)
if (localpet == 0) then
print*,"- READ SEAICE SKIN TEMPERATURE."
call nemsio_readrecv(gfile, "ti", "sfc", 1, dummy, 0, iret=rc)
if (rc /= 0) call error_handler("READING SEAICE SKIN TEMP.", rc)
dummy2d = reshape(dummy, (/i_input,j_input/))
print*,'ti ',maxval(dummy2d),minval(dummy2d)
endif
print*,"- CALL FieldScatter FOR INPUT GRID SEAICE SKIN TEMPERATURE."
call ESMF_FieldScatter(seaice_skin_temp_input_grid, dummy2d, rootpet=0, rc=rc)
if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) &
call error_handler("IN FieldScatter", rc)
if (localpet == 0) then
print*,"- READ SNOW LIQUID EQUIVALENT."
call nemsio_readrecv(gfile, "weasd", "sfc", 1, dummy, 0, iret=rc)
if (rc /= 0) call error_handler("READING SNOW LIQUID EQUIVALENT.", rc)
dummy2d = reshape(dummy, (/i_input,j_input/))
print*,'weasd ',maxval(dummy2d),minval(dummy2d)
endif
print*,"- CALL FieldScatter FOR INPUT GRID SNOW LIQUID EQUIVALENT."
call ESMF_FieldScatter(snow_liq_equiv_input_grid, dummy2d, rootpet=0, rc=rc)
if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) &
call error_handler("IN FieldScatter", rc)
if (localpet == 0) then
print*,"- READ SNOW DEPTH."
call nemsio_readrecv(gfile, "snod", "sfc", 1, dummy, 0, iret=rc)
if (rc /= 0) call error_handler("READING SNOW DEPTH.", rc)
dummy2d = reshape(dummy, (/i_input,j_input/)) * 1000.0_8
print*,'snod ',maxval(dummy2d),minval(dummy2d)
endif
print*,"- CALL FieldScatter FOR INPUT GRID SNOW DEPTH."
call ESMF_FieldScatter(snow_depth_input_grid, dummy2d, rootpet=0, rc=rc)
if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) &
call error_handler("IN FieldScatter", rc)
if (localpet == 0) then
print*,"- READ VEG TYPE."
call nemsio_readrecv(gfile, "vtype", "sfc", 1, dummy, 0, iret=rc)
if (rc /= 0) call error_handler("READING VEG TYPE", rc)
dummy2d = reshape(dummy, (/i_input,j_input/))
print*,'vtype ',maxval(dummy2d),minval(dummy2d)
endif
print*,"- CALL FieldScatter FOR INPUT GRID VEG TYPE."
call ESMF_FieldScatter(veg_type_input_grid, dummy2d, rootpet=0, rc=rc)
if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) &
call error_handler("IN FieldScatter", rc)
if (localpet == 0) then
print*,"- READ SOIL TYPE."
call nemsio_readrecv(gfile, "sotyp", "sfc", 1, dummy, 0, iret=rc)
if (rc /= 0) call error_handler("READING SOIL TYPE.", rc)
dummy2d = reshape(dummy, (/i_input,j_input/))
print*,'sotype ',maxval(dummy2d),minval(dummy2d)
endif
print*,"- CALL FieldScatter FOR INPUT GRID SOIL TYPE."
call ESMF_FieldScatter(soil_type_input_grid, dummy2d, rootpet=0, rc=rc)
if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) &
call error_handler("IN FieldScatter", rc)
if (localpet == 0) then
print*,"- READ T2M."
call nemsio_readrecv(gfile, "tmp", "2 m above gnd", 1, dummy, 0, iret=rc)
if (rc /= 0) call error_handler("READING T2M.", rc)
dummy2d = reshape(dummy, (/i_input,j_input/))
print*,'t2m ',maxval(dummy2d),minval(dummy2d)
endif
print*,"- CALL FieldScatter FOR INPUT GRID T2M."
call ESMF_FieldScatter(t2m_input_grid, dummy2d, rootpet=0, rc=rc)
if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) &
call error_handler("IN FieldScatter", rc)
if (localpet == 0) then
print*,"- READ Q2M."
call nemsio_readrecv(gfile, "spfh", "2 m above gnd", 1, dummy, 0, iret=rc)
if (rc /= 0) call error_handler("READING Q2M.", rc)
dummy2d = reshape(dummy, (/i_input,j_input/))
print*,'q2m ',maxval(dummy2d),minval(dummy2d)
endif
print*,"- CALL FieldScatter FOR INPUT GRID Q2M."
call ESMF_FieldScatter(q2m_input_grid, dummy2d, rootpet=0, rc=rc)
if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) &
call error_handler("IN FieldScatter", rc)
if (localpet == 0) then
print*,"- READ TPRCP."
call nemsio_readrecv(gfile, "tprcp", "sfc", 1, dummy, 0, iret=rc)
if (rc /= 0) call error_handler("READING TPRCP.", rc)
dummy2d = reshape(dummy, (/i_input,j_input/))
print*,'tprcp ',maxval(dummy2d),minval(dummy2d)
endif
print*,"- CALL FieldScatter FOR INPUT GRID TPRCP."
call ESMF_FieldScatter(tprcp_input_grid, dummy2d, rootpet=0, rc=rc)
if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) &
call error_handler("IN FieldScatter", rc)
if (localpet == 0) then
print*,"- READ FFMM."
call nemsio_readrecv(gfile, "ffmm", "sfc", 1, dummy, 0, iret=rc)
if (rc /= 0) call error_handler("READING FFMM.", rc)
dummy2d = reshape(dummy, (/i_input,j_input/))
print*,'ffmm ',maxval(dummy2d),minval(dummy2d)
endif
print*,"- CALL FieldScatter FOR INPUT GRID FFMM"
call ESMF_FieldScatter(ffmm_input_grid, dummy2d, rootpet=0, rc=rc)
if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) &
call error_handler("IN FieldScatter", rc)
if (localpet == 0) then
print*,"- READ USTAR."
call nemsio_readrecv(gfile, "fricv", "sfc", 1, dummy, 0, iret=rc)
if (rc /= 0) call error_handler("READING USTAR.", rc)
dummy2d = reshape(dummy, (/i_input,j_input/))
print*,'fricv ',maxval(dummy2d),minval(dummy2d)
endif
print*,"- CALL FieldScatter FOR INPUT GRID USTAR"
call ESMF_FieldScatter(ustar_input_grid, dummy2d, rootpet=0, rc=rc)
if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) &
call error_handler("IN FieldScatter", rc)
if (localpet == 0) dummy2d = 0.0
print*,"- CALL FieldScatter FOR INPUT GRID SRFLAG"
call ESMF_FieldScatter(srflag_input_grid, dummy2d, rootpet=0, rc=rc)
if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) &
call error_handler("IN FieldScatter", rc)
if (localpet == 0) then
print*,"- READ SKIN TEMPERATURE."
call nemsio_readrecv(gfile, "tmp", "sfc", 1, dummy, 0, iret=rc)
if (rc /= 0) call error_handler("READING SKIN TEMPERATURE.", rc)
dummy2d = reshape(dummy, (/i_input,j_input/))
print*,'tmp ',maxval(dummy2d),minval(dummy2d)
endif
print*,"- CALL FieldScatter FOR INPUT GRID SKIN TEMPERATURE"
call ESMF_FieldScatter(skin_temp_input_grid, dummy2d, rootpet=0, rc=rc)
if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) &
call error_handler("IN FieldScatter", rc)
if (localpet == 0) then
print*,"- READ F10M."
call nemsio_readrecv(gfile, "f10m", "10 m above gnd", 1, dummy, 0, iret=rc)
if (rc /= 0) call error_handler("READING F10M.", rc)
dummy2d = reshape(dummy, (/i_input,j_input/))
print*,'f10m ',maxval(dummy2d),minval(dummy2d)
endif
print*,"- CALL FieldScatter FOR INPUT GRID F10M."
call ESMF_FieldScatter(f10m_input_grid, dummy2d, rootpet=0, rc=rc)
if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) &
call error_handler("IN FieldScatter", rc)
if (localpet == 0) then
print*,"- READ CANOPY MOISTURE CONTENT."
call nemsio_readrecv(gfile, "cnwat", "sfc", 1, dummy, 0, iret=rc)
if (rc /= 0) call error_handler("READING CANOPY MOISTURE CONTENT.", rc)
dummy2d = reshape(dummy, (/i_input,j_input/))
print*,'cnwat ',maxval(dummy2d),minval(dummy2d)
endif
print*,"- CALL FieldScatter FOR INPUT GRID CANOPY MOISTURE CONTENT."
call ESMF_FieldScatter(canopy_mc_input_grid, dummy2d, rootpet=0, rc=rc)
if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) &
call error_handler("IN FieldScatter", rc)
if (localpet == 0) then
print*,"- READ Z0."
call nemsio_readrecv(gfile, "sfcr", "sfc", 1, dummy, 0, iret=rc)
if (rc /= 0) call error_handler("READING Z0.", rc)
dummy2d = reshape(dummy, (/i_input,j_input/)) * 100.0_8 ! convert to cm
print*,'sfcr ',maxval(dummy2d),minval(dummy2d)
endif