-
Notifications
You must be signed in to change notification settings - Fork 4
/
readparam_code.f
1605 lines (1405 loc) · 58.6 KB
/
readparam_code.f
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
c readparam_code.f
ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
subroutine READPARAM_CODE(dt,deltax,deltay,Utau_t_flag,
& subgrid_flag,erosion_dist,tp_scale,twolayer_flag,
& bc_flag,curve_len_scale,slopewt,curvewt,ht_windobs,
& ht_rhobs,ro_snow,snow_d_init_const,const_veg_flag,
& vegsnowdepth,nx,ny,max_iter,met_input_fname,xmn,ymn,
& iyear_init,imonth_init,iday_init,xhour_init,undef,ifill,
& iobsint,dn,xlat,i_tair_flag,i_rh_flag,i_wind_flag,
& i_solar_flag,i_prec_flag,isingle_stn_flag,igrads_metfile,
& windspd_min,icond_flag,run_micromet,run_enbal,run_snowpack,
& run_snowtran,topoflag,topoveg_fname,snowtran_output_fname,
& micromet_output_fname,enbal_output_fname,Utau_t_const,
& snowpack_output_fname,print_micromet,print_enbal,
& print_snowpack,print_snowtran,i_longwave_flag,print_user,
& iprint_inc,ascii_topoveg,topo_ascii_fname,veg_ascii_fname,
& irun_data_assim,lapse_rate_user_flag,
& iprecip_lapse_rate_user_flag,use_shortwave_obs,
& use_longwave_obs,use_sfc_pressure_obs,calc_subcanopy_met,
& sfc_sublim_flag,gap_frac,cloud_frac_factor,
& albedo_glacier,barnes_lg_domain,n_stns_used,tabler_dir,
& slope_adjust,lat_solar_flag,UTC_flag,iveg_ht_flag,
& ihrestart_flag,ihrestart_inc,i_dataassim_loop,tsls_threshold,
& dz_snow_min,print_multilayer,multilayer_snowpack,max_layers,
& multilayer_output_fname,izero_snow_date,curve_lg_scale_flag,
& check_met_data,seaice_run,snowmodel_line_flag,wind_lapse_rate,
& albedo_diff,al_max,al_min,al_dec_cold,al_dec_melt,
& fc_param,t_avg,albedo_flag,pertPrec,depth_assim)
c These programs read and process the input parameter data.
c
c The following must be true:
c
c All comment lines start with a ! in the first position.
c
c Blank lines are permitted.
c
c All parameter statements start with the parameter name, followed
c by a space, followed by an =, followed by a space, followed by
c the actual value, with nothing after that. These statements can
c have leading blanks, and must fit within 80 columns.
c
c It is set up to deal with integer, real, and string input values.
implicit none
include 'snowmodel.inc'
c Put parameter names here:
real dt,deltax,deltay,Utau_t_flag,topoflag,Utau_t_const,
& subgrid_flag,erosion_dist,tp_scale,twolayer_flag,
& bc_flag,curve_len_scale,slopewt,curvewt,ht_windobs,
& ht_rhobs,ro_snow,snow_d_init_const,const_veg_flag,
& windspd_min,ascii_topoveg,gap_frac,cloud_frac_factor,
& albedo_glacier,barnes_lg_domain,tabler_dir,slope_adjust,
& UTC_flag,tsls_threshold,dz_snow_min,print_multilayer,
& curve_lg_scale_flag,check_met_data,seaice_run,
& snowmodel_line_flag,wind_lapse_rate,albedo_diff,al_max,
& al_min,al_dec_cold,al_dec_melt,fc_param,t_avg,pertPrec
real vegsnowdepth(nvegtypes)
real run_micromet,run_enbal,run_snowpack,run_snowtran,
& print_micromet,print_enbal,print_snowpack,print_snowtran,
& print_user,use_shortwave_obs,use_longwave_obs,
& use_sfc_pressure_obs,calc_subcanopy_met,sfc_sublim_flag
integer nx,ny,max_iter,iprint_inc,icond_flag,irun_data_assim,
& depth_assim
character*80 topoveg_fname,met_input_fname,topo_ascii_fname,
& veg_ascii_fname
character*80 snowtran_output_fname,micromet_output_fname,
& enbal_output_fname,snowpack_output_fname,multilayer_output_fname
integer iyear_init,imonth_init,iday_init,
& i_tair_flag,i_rh_flag,i_wind_flag,i_solar_flag,i_prec_flag,
& i_longwave_flag,isingle_stn_flag,igrads_metfile,
& lapse_rate_user_flag,iprecip_lapse_rate_user_flag,
& n_stns_used,iveg_ht_flag,lat_solar_flag,ihrestart_inc,
& ihrestart_flag,i_dataassim_loop,multilayer_snowpack,max_layers,
& izero_snow_date,albedo_flag
double precision xmn,ymn
real xhour_init,dn
real undef ! undefined value
integer ifill ! flag (=1) forces a value in every cell
integer iobsint ! flag (=1) use dn value from .par file
real xlat ! approx. latitude of domain center, decimal deg
c Working parameters.
character*80 input_string,c_param,c_value
integer k,max_par_lines,i_param_chars,i_value_chars,
& icomment_flag,npars,ipar_flag
parameter (npars=111)
integer ipar_count
character*40 cpar_name(npars)
max_par_lines = 1000
open (40,file='snowmodel.par')
c Initialize the input-parameter counting array. This is used to
c make sure all of the input parameters are read in correctly.
c Also initialize a array that will collect the variable names
c that have been read in, so it can be compared against the .par
c file to help figure out which variables have not been defined
c before the model simulation starts.
ipar_count = 0
do k=1,npars
cpar_name(k) = ' BLANK: SOMETHING IS NOT DEFINED'
enddo
do k=1,max_par_lines
read (40,'(a80)',end=99) input_string
call get_param_data(input_string,c_param,c_value,
& i_param_chars,i_value_chars,icomment_flag)
c Process the string if it is not a comment.
if (icomment_flag.eq.0) then
c GENERAL MODEL SETUP.
if (c_param(1:i_param_chars).eq.'nx') then
ipar_count = ipar_count + 1
cpar_name(ipar_count) = c_param(1:i_param_chars)
call char2int(nx,i_value_chars,c_value,
& c_param(1:i_param_chars))
if (nx.le.0) then
print *,'nx cannot be less than or equal to 0'
stop
endif
endif
if (c_param(1:i_param_chars).eq.'ny') then
ipar_count = ipar_count + 1
cpar_name(ipar_count) = c_param(1:i_param_chars)
call char2int(ny,i_value_chars,c_value,
& c_param(1:i_param_chars))
if (ny.le.0) then
print *,'ny cannot be less than or equal to 0'
stop
endif
endif
if (c_param(1:i_param_chars).eq.'deltax') then
ipar_count = ipar_count + 1
cpar_name(ipar_count) = c_param(1:i_param_chars)
call char2real(deltax,i_value_chars,c_value,
& c_param(1:i_param_chars))
if (deltax.le.0.0) then
print *,'deltax cannot be less than or equal to 0.0'
stop
endif
endif
if (c_param(1:i_param_chars).eq.'deltay') then
ipar_count = ipar_count + 1
cpar_name(ipar_count) = c_param(1:i_param_chars)
call char2real(deltay,i_value_chars,c_value,
& c_param(1:i_param_chars))
if (deltay.le.0.0) then
print *,'deltay cannot be less than or equal to 0.0'
stop
endif
endif
if (c_param(1:i_param_chars).eq.'xmn') then
ipar_count = ipar_count + 1
cpar_name(ipar_count) = c_param(1:i_param_chars)
call char2double(xmn,i_value_chars,c_value,
& c_param(1:i_param_chars))
endif
if (c_param(1:i_param_chars).eq.'ymn') then
ipar_count = ipar_count + 1
cpar_name(ipar_count) = c_param(1:i_param_chars)
call char2double(ymn,i_value_chars,c_value,
& c_param(1:i_param_chars))
endif
if (c_param(1:i_param_chars).eq.'dt') then
ipar_count = ipar_count + 1
cpar_name(ipar_count) = c_param(1:i_param_chars)
call char2real(dt,i_value_chars,c_value,
& c_param(1:i_param_chars))
if (dt.le.0.0 .or. dt.gt.86400.0) then
print *,'dt out of range'
stop
endif
endif
if (c_param(1:i_param_chars).eq.'iyear_init') then
ipar_count = ipar_count + 1
cpar_name(ipar_count) = c_param(1:i_param_chars)
call char2int(iyear_init,i_value_chars,c_value,
& c_param(1:i_param_chars))
if (iyear_init.lt.1900 .or. iyear_init.gt.2100) then
print *,'iyear_init out of range'
stop
endif
endif
if (c_param(1:i_param_chars).eq.'imonth_init') then
ipar_count = ipar_count + 1
cpar_name(ipar_count) = c_param(1:i_param_chars)
call char2int(imonth_init,i_value_chars,c_value,
& c_param(1:i_param_chars))
if (imonth_init.lt.1 .or. imonth_init.gt.12) then
print *,'imonth_init out of range'
stop
endif
endif
if (c_param(1:i_param_chars).eq.'iday_init') then
ipar_count = ipar_count + 1
cpar_name(ipar_count) = c_param(1:i_param_chars)
call char2int(iday_init,i_value_chars,c_value,
& c_param(1:i_param_chars))
if (iday_init.lt.1 .or. iday_init.gt.31) then
print *,'iday_init out of range'
stop
endif
endif
if (c_param(1:i_param_chars).eq.'xhour_init') then
ipar_count = ipar_count + 1
cpar_name(ipar_count) = c_param(1:i_param_chars)
call char2real(xhour_init,i_value_chars,c_value,
& c_param(1:i_param_chars))
if (xhour_init.lt.0.0 .or. xhour_init.ge.24.0) then
print *,'xhour_init out of range'
stop
endif
endif
if (c_param(1:i_param_chars).eq.'max_iter') then
ipar_count = ipar_count + 1
cpar_name(ipar_count) = c_param(1:i_param_chars)
call char2int(max_iter,i_value_chars,c_value,
& c_param(1:i_param_chars))
if (max_iter.le.0 .or. max_iter.gt.300000) then
print *,'max_iter out of range'
stop
endif
endif
if (c_param(1:i_param_chars).eq.'isingle_stn_flag') then
ipar_count = ipar_count + 1
cpar_name(ipar_count) = c_param(1:i_param_chars)
call char2int(isingle_stn_flag,i_value_chars,c_value,
& c_param(1:i_param_chars))
if (isingle_stn_flag.ne.0 .and. isingle_stn_flag.ne.1) then
print *,'isingle_stn_flag not 0 or 1'
stop
endif
endif
if (c_param(1:i_param_chars).eq.'igrads_metfile') then
ipar_count = ipar_count + 1
cpar_name(ipar_count) = c_param(1:i_param_chars)
call char2int(igrads_metfile,i_value_chars,c_value,
& c_param(1:i_param_chars))
if (igrads_metfile.ne.0 .and. igrads_metfile.ne.1) then
print *,'igrads_metfile not 0 or 1'
stop
endif
endif
if (c_param(1:i_param_chars).eq.'met_input_fname') then
ipar_count = ipar_count + 1
cpar_name(ipar_count) = c_param(1:i_param_chars)
call char2char(met_input_fname,c_value,i_value_chars,
& c_param(1:i_param_chars))
endif
if (c_param(1:i_param_chars).eq.'undef') then
ipar_count = ipar_count + 1
cpar_name(ipar_count) = c_param(1:i_param_chars)
call char2real(undef,i_value_chars,c_value,
& c_param(1:i_param_chars))
endif
if (c_param(1:i_param_chars).eq.'ascii_topoveg') then
ipar_count = ipar_count + 1
cpar_name(ipar_count) = c_param(1:i_param_chars)
call char2real(ascii_topoveg,i_value_chars,c_value,
& c_param(1:i_param_chars))
if (ascii_topoveg.ne.0.0 .and. ascii_topoveg.ne.1.0) then
print *,'ascii_topoveg not 0.0 or 1.0'
stop
endif
endif
if (c_param(1:i_param_chars).eq.'topoveg_fname') then
ipar_count = ipar_count + 1
cpar_name(ipar_count) = c_param(1:i_param_chars)
call char2char(topoveg_fname,c_value,i_value_chars,
& c_param(1:i_param_chars))
endif
if (c_param(1:i_param_chars).eq.'topo_ascii_fname') then
ipar_count = ipar_count + 1
cpar_name(ipar_count) = c_param(1:i_param_chars)
call char2char(topo_ascii_fname,c_value,i_value_chars,
& c_param(1:i_param_chars))
endif
if (c_param(1:i_param_chars).eq.'veg_ascii_fname') then
ipar_count = ipar_count + 1
cpar_name(ipar_count) = c_param(1:i_param_chars)
call char2char(veg_ascii_fname,c_value,i_value_chars,
& c_param(1:i_param_chars))
endif
c if (c_param(1:i_param_chars).eq.'veg_shd_24') then
c call char2real(vegsnowdepth(24),i_value_chars,c_value,
c & c_param(1:i_param_chars))
c if (vegsnowdepth(24).lt.0.0 .or. vegsnowdepth(24).gt.20.0)
c & then
c print *,'veg_shd_24 out of range'
c stop
c endif
c endif
if (c_param(1:i_param_chars).eq.'veg_shd_25') then
ipar_count = ipar_count + 1
cpar_name(ipar_count) = c_param(1:i_param_chars)
call char2real(vegsnowdepth(25),i_value_chars,c_value,
& c_param(1:i_param_chars))
if (vegsnowdepth(25).lt.0.0 .or. vegsnowdepth(25).gt.20.0)
& then
print *,'veg_shd_25 out of range'
stop
endif
endif
if (c_param(1:i_param_chars).eq.'veg_shd_26') then
ipar_count = ipar_count + 1
cpar_name(ipar_count) = c_param(1:i_param_chars)
call char2real(vegsnowdepth(26),i_value_chars,c_value,
& c_param(1:i_param_chars))
if (vegsnowdepth(26).lt.0.0 .or. vegsnowdepth(26).gt.20.0)
& then
print *,'veg_shd_26 out of range'
stop
endif
endif
if (c_param(1:i_param_chars).eq.'veg_shd_27') then
ipar_count = ipar_count + 1
cpar_name(ipar_count) = c_param(1:i_param_chars)
call char2real(vegsnowdepth(27),i_value_chars,c_value,
& c_param(1:i_param_chars))
if (vegsnowdepth(27).lt.0.0 .or. vegsnowdepth(27).gt.20.0)
& then
print *,'veg_shd_27 out of range'
stop
endif
endif
if (c_param(1:i_param_chars).eq.'veg_shd_28') then
ipar_count = ipar_count + 1
cpar_name(ipar_count) = c_param(1:i_param_chars)
call char2real(vegsnowdepth(28),i_value_chars,c_value,
& c_param(1:i_param_chars))
if (vegsnowdepth(28).lt.0.0 .or. vegsnowdepth(28).gt.20.0)
& then
print *,'veg_shd_28 out of range'
stop
endif
endif
if (c_param(1:i_param_chars).eq.'veg_shd_29') then
ipar_count = ipar_count + 1
cpar_name(ipar_count) = c_param(1:i_param_chars)
call char2real(vegsnowdepth(29),i_value_chars,c_value,
& c_param(1:i_param_chars))
if (vegsnowdepth(29).lt.0.0 .or. vegsnowdepth(29).gt.20.0)
& then
print *,'veg_shd_29 out of range'
stop
endif
endif
if (c_param(1:i_param_chars).eq.'veg_shd_30') then
ipar_count = ipar_count + 1
cpar_name(ipar_count) = c_param(1:i_param_chars)
call char2real(vegsnowdepth(30),i_value_chars,c_value,
& c_param(1:i_param_chars))
if (vegsnowdepth(30).lt.0.0 .or. vegsnowdepth(30).gt.20.0)
& then
print *,'veg_shd_30 out of range'
stop
endif
endif
if (c_param(1:i_param_chars).eq.'const_veg_flag') then
ipar_count = ipar_count + 1
cpar_name(ipar_count) = c_param(1:i_param_chars)
call char2real(const_veg_flag,i_value_chars,c_value,
& c_param(1:i_param_chars))
if (const_veg_flag.lt.0.0 .or. const_veg_flag.gt.30.0) then
print *,'const_veg_flag out of range'
stop
endif
endif
if (c_param(1:i_param_chars).eq.'iveg_ht_flag') then
ipar_count = ipar_count + 1
cpar_name(ipar_count) = c_param(1:i_param_chars)
call char2int(iveg_ht_flag,i_value_chars,c_value,
& c_param(1:i_param_chars))
if (iveg_ht_flag.lt.-1 .or. iveg_ht_flag.gt.1) then
print *,'iveg_ht_flag out of range'
stop
endif
endif
if (c_param(1:i_param_chars).eq.'xlat') then
ipar_count = ipar_count + 1
cpar_name(ipar_count) = c_param(1:i_param_chars)
call char2real(xlat,i_value_chars,c_value,
& c_param(1:i_param_chars))
if (xlat.lt.-90.0 .or. xlat.gt.90.0) then
print *,'xlat out of range'
stop
endif
endif
if (c_param(1:i_param_chars).eq.'lat_solar_flag') then
ipar_count = ipar_count + 1
cpar_name(ipar_count) = c_param(1:i_param_chars)
call char2int(lat_solar_flag,i_value_chars,c_value,
& c_param(1:i_param_chars))
if (lat_solar_flag.lt.-1 .or. lat_solar_flag.gt.1) then
print *,'lat_solar_flag out of range'
stop
endif
endif
if (c_param(1:i_param_chars).eq.'UTC_flag') then
ipar_count = ipar_count + 1
cpar_name(ipar_count) = c_param(1:i_param_chars)
call char2real(UTC_flag,i_value_chars,c_value,
& c_param(1:i_param_chars))
if (UTC_flag.lt.-1 .or. UTC_flag.gt.1) then
print *,'UTC_flag out of range'
stop
endif
endif
if (c_param(1:i_param_chars).eq.'run_micromet') then
ipar_count = ipar_count + 1
cpar_name(ipar_count) = c_param(1:i_param_chars)
call char2real(run_micromet,i_value_chars,c_value,
& c_param(1:i_param_chars))
if (run_micromet.ne.0.0 .and. run_micromet.ne.1.0) then
print *,'run_micromet not 0.0 or 1.0'
stop
endif
endif
if (c_param(1:i_param_chars).eq.'run_enbal') then
ipar_count = ipar_count + 1
cpar_name(ipar_count) = c_param(1:i_param_chars)
call char2real(run_enbal,i_value_chars,c_value,
& c_param(1:i_param_chars))
if (run_enbal.ne.0.0 .and. run_enbal.ne.1.0) then
print *,'run_enbal not 0.0 or 1.0'
stop
endif
endif
if (c_param(1:i_param_chars).eq.'run_snowpack') then
ipar_count = ipar_count + 1
cpar_name(ipar_count) = c_param(1:i_param_chars)
call char2real(run_snowpack,i_value_chars,c_value,
& c_param(1:i_param_chars))
if (run_snowpack.ne.0.0 .and. run_snowpack.ne.1.0) then
print *,'run_snowpack not 0.0 or 1.0'
stop
endif
endif
if (c_param(1:i_param_chars).eq.'run_snowtran') then
ipar_count = ipar_count + 1
cpar_name(ipar_count) = c_param(1:i_param_chars)
call char2real(run_snowtran,i_value_chars,c_value,
& c_param(1:i_param_chars))
if (run_snowtran.ne.0.0 .and. run_snowtran.ne.1.0) then
print *,'run_snowtran not 0.0 or 1.0'
stop
endif
endif
if (c_param(1:i_param_chars).eq.'irun_data_assim') then
ipar_count = ipar_count + 1
cpar_name(ipar_count) = c_param(1:i_param_chars)
call char2int(irun_data_assim,i_value_chars,c_value,
& c_param(1:i_param_chars))
if (irun_data_assim.ne.0 .and. irun_data_assim.ne.1) then
print *,'irun_data_assim not 0 or 1'
stop
endif
endif
if (c_param(1:i_param_chars).eq.'depth_assim') then
ipar_count = ipar_count + 1
cpar_name(ipar_count) = c_param(1:i_param_chars)
call char2int(depth_assim,i_value_chars,c_value,
& c_param(1:i_param_chars))
if (depth_assim.ne.0 .and. depth_assim.ne.1) then
print *,'depth_assim not 0 or 1'
stop
endif
endif
if (c_param(1:i_param_chars).eq.'ihrestart_flag') then
ipar_count = ipar_count + 1
cpar_name(ipar_count) = c_param(1:i_param_chars)
call char2int(ihrestart_flag,i_value_chars,c_value,
& c_param(1:i_param_chars))
if (ihrestart_flag.lt.-2 .or. ihrestart_flag.gt.300000) then
print *,'ihrestart_flag out of range'
stop
endif
endif
if (c_param(1:i_param_chars).eq.'i_dataassim_loop') then
ipar_count = ipar_count + 1
cpar_name(ipar_count) = c_param(1:i_param_chars)
call char2int(i_dataassim_loop,i_value_chars,c_value,
& c_param(1:i_param_chars))
if (i_dataassim_loop.lt.-366 .or. i_dataassim_loop.gt.1)
& then
print *,'i_dataassim_loop out of range'
stop
endif
endif
if (c_param(1:i_param_chars).eq.'ihrestart_inc') then
ipar_count = ipar_count + 1
cpar_name(ipar_count) = c_param(1:i_param_chars)
call char2int(ihrestart_inc,i_value_chars,c_value,
& c_param(1:i_param_chars))
if (ihrestart_inc.lt.0 .or. ihrestart_inc.gt.8784) then
print *,'ihrestart_inc out of range'
stop
endif
endif
if (c_param(1:i_param_chars).eq.'print_user') then
ipar_count = ipar_count + 1
cpar_name(ipar_count) = c_param(1:i_param_chars)
call char2real(print_user,i_value_chars,c_value,
& c_param(1:i_param_chars))
if (print_user.ne.0.0 .and. print_user.ne.1.0) then
print *,'print_user not 0.0 or 1.0'
stop
endif
endif
if (c_param(1:i_param_chars).eq.'iprint_inc') then
ipar_count = ipar_count + 1
cpar_name(ipar_count) = c_param(1:i_param_chars)
call char2int(iprint_inc,i_value_chars,c_value,
& c_param(1:i_param_chars))
if (iprint_inc.lt.1 .or. iprint_inc.gt.720) then
print *,'iprint_inc out of range'
stop
endif
endif
c MICROMET MODEL SETUP.
if (c_param(1:i_param_chars).eq.'i_tair_flag') then
ipar_count = ipar_count + 1
cpar_name(ipar_count) = c_param(1:i_param_chars)
call char2int(i_tair_flag,i_value_chars,c_value,
& c_param(1:i_param_chars))
if (i_tair_flag.ne.0 .and. i_tair_flag.ne.1) then
print *,'i_tair_flag not 0 or 1'
stop
endif
endif
if (c_param(1:i_param_chars).eq.'i_rh_flag') then
ipar_count = ipar_count + 1
cpar_name(ipar_count) = c_param(1:i_param_chars)
call char2int(i_rh_flag,i_value_chars,c_value,
& c_param(1:i_param_chars))
if (i_rh_flag.ne.0 .and. i_rh_flag.ne.1) then
print *,'i_rh_flag not 0 or 1'
stop
endif
endif
if (c_param(1:i_param_chars).eq.'i_wind_flag') then
ipar_count = ipar_count + 1
cpar_name(ipar_count) = c_param(1:i_param_chars)
call char2int(i_wind_flag,i_value_chars,c_value,
& c_param(1:i_param_chars))
if (i_wind_flag.ne.-1 .and. i_wind_flag.ne.0 .and.
& i_wind_flag.ne.1) then
print *,'i_wind_flag not -1, 0, or 1'
stop
endif
endif
if (c_param(1:i_param_chars).eq.'i_solar_flag') then
ipar_count = ipar_count + 1
cpar_name(ipar_count) = c_param(1:i_param_chars)
call char2int(i_solar_flag,i_value_chars,c_value,
& c_param(1:i_param_chars))
if (i_solar_flag.ne.0 .and. i_solar_flag.ne.1) then
print *,'i_solar_flag not 0 or 1'
stop
endif
endif
if (c_param(1:i_param_chars).eq.'i_longwave_flag') then
ipar_count = ipar_count + 1
cpar_name(ipar_count) = c_param(1:i_param_chars)
call char2int(i_longwave_flag,i_value_chars,c_value,
& c_param(1:i_param_chars))
if (i_longwave_flag.ne.0 .and. i_longwave_flag.ne.1) then
print *,'i_longwave_flag not 0 or 1'
stop
endif
endif
c J.PFLUG
if (c_param(1:i_param_chars).eq.'i_prec_flag') then
ipar_count = ipar_count + 1
cpar_name(ipar_count) = c_param(1:i_param_chars)
call char2int(i_prec_flag,i_value_chars,c_value,
& c_param(1:i_param_chars))
if (i_prec_flag.ne.0 .and. i_prec_flag.ne.1 .and.
& i_prec_flag.ne.-1) then
print *,'i_prec_flag not 0,1,or -1'
stop
endif
endif
c END J.PFLUG
if (c_param(1:i_param_chars).eq.'ifill') then
ipar_count = ipar_count + 1
cpar_name(ipar_count) = c_param(1:i_param_chars)
call char2int(ifill,i_value_chars,c_value,
& c_param(1:i_param_chars))
if (ifill.ne.0 .and. ifill.ne.1) then
print *,'ifill not 0 or 1'
stop
endif
endif
if (c_param(1:i_param_chars).eq.'iobsint') then
ipar_count = ipar_count + 1
cpar_name(ipar_count) = c_param(1:i_param_chars)
call char2int(iobsint,i_value_chars,c_value,
& c_param(1:i_param_chars))
if (iobsint.ne.0 .and. iobsint.ne.1) then
print *,'iobsint not 0 or 1'
stop
endif
endif
if (c_param(1:i_param_chars).eq.'dn') then
ipar_count = ipar_count + 1
cpar_name(ipar_count) = c_param(1:i_param_chars)
call char2real(dn,i_value_chars,c_value,
& c_param(1:i_param_chars))
if (dn.lt.1.0 .or. dn.gt.10000.0) then
print *,'dn out of range'
stop
endif
endif
if (c_param(1:i_param_chars).eq.'barnes_lg_domain') then
ipar_count = ipar_count + 1
cpar_name(ipar_count) = c_param(1:i_param_chars)
call char2real(barnes_lg_domain,i_value_chars,c_value,
& c_param(1:i_param_chars))
if (barnes_lg_domain.ne.0.0 .and. barnes_lg_domain.ne.1.0
& .and. barnes_lg_domain.ne.2.0) then
print *,'barnes_lg_domain not 0.0 or 1.0 or 2.0'
stop
endif
endif
if (c_param(1:i_param_chars).eq.'n_stns_used') then
ipar_count = ipar_count + 1
cpar_name(ipar_count) = c_param(1:i_param_chars)
call char2int(n_stns_used,i_value_chars,c_value,
& c_param(1:i_param_chars))
if (n_stns_used.lt.1 .or. n_stns_used.gt.5) then
print *,'n_stns_used out of range'
stop
endif
endif
if (c_param(1:i_param_chars).eq.'snowmodel_line_flag') then
ipar_count = ipar_count + 1
cpar_name(ipar_count) = c_param(1:i_param_chars)
call char2real(snowmodel_line_flag,i_value_chars,c_value,
& c_param(1:i_param_chars))
if (snowmodel_line_flag.ne.0.0 .and.
& snowmodel_line_flag.ne.1.0)
& then
print *,'snowmodel_line_flag not 0.0 or 1.0'
stop
endif
endif
if (c_param(1:i_param_chars).eq.'check_met_data') then
ipar_count = ipar_count + 1
cpar_name(ipar_count) = c_param(1:i_param_chars)
call char2real(check_met_data,i_value_chars,c_value,
& c_param(1:i_param_chars))
if (check_met_data.ne.0.0 .and. check_met_data.ne.1.0)
& then
print *,'check_met_data not 0.0 or 1.0'
stop
endif
endif
if (c_param(1:i_param_chars).eq.'curve_len_scale') then
ipar_count = ipar_count + 1
cpar_name(ipar_count) = c_param(1:i_param_chars)
call char2real(curve_len_scale,i_value_chars,c_value,
& c_param(1:i_param_chars))
if (curve_len_scale.le.0.0 .or. curve_len_scale.gt.5000.0)
& then
print *,'curve_len_scale out of range'
stop
endif
endif
if (c_param(1:i_param_chars).eq.'slopewt') then
ipar_count = ipar_count + 1
cpar_name(ipar_count) = c_param(1:i_param_chars)
call char2real(slopewt,i_value_chars,c_value,
& c_param(1:i_param_chars))
if (slopewt.lt.0.0 .or. slopewt.gt.1.0) then
print *,'slopewt out of range'
stop
endif
endif
if (c_param(1:i_param_chars).eq.'curvewt') then
ipar_count = ipar_count + 1
cpar_name(ipar_count) = c_param(1:i_param_chars)
call char2real(curvewt,i_value_chars,c_value,
& c_param(1:i_param_chars))
if (curvewt.lt.0.0 .or. curvewt.gt.1.0) then
print *,'curvewt out of range'
stop
endif
endif
if (c_param(1:i_param_chars).eq.'curve_lg_scale_flag') then
ipar_count = ipar_count + 1
cpar_name(ipar_count) = c_param(1:i_param_chars)
call char2real(curve_lg_scale_flag,i_value_chars,c_value,
& c_param(1:i_param_chars))
if (curve_lg_scale_flag.ne.0.0 .and.
& curve_lg_scale_flag.ne.1.0) then
print *,'curve_lg_scale_flag not 0.0 or 1.0'
stop
endif
endif
if (c_param(1:i_param_chars).eq.'windspd_min') then
ipar_count = ipar_count + 1
cpar_name(ipar_count) = c_param(1:i_param_chars)
call char2real(windspd_min,i_value_chars,c_value,
& c_param(1:i_param_chars))
if (windspd_min.lt.0.1 .or. windspd_min.gt.2.0) then
print *,'windspd_min out of range'
stop
endif
endif
if (c_param(1:i_param_chars).eq.'lapse_rate_user_flag') then
ipar_count = ipar_count + 1
cpar_name(ipar_count) = c_param(1:i_param_chars)
call char2int(lapse_rate_user_flag,i_value_chars,c_value,
& c_param(1:i_param_chars))
if (lapse_rate_user_flag.ne.0 .and.
& lapse_rate_user_flag.ne.1) then
print *,'lapse_rate_user_flag not 0 or 1'
stop
endif
endif
if (c_param(1:i_param_chars).eq.
& 'iprecip_lapse_rate_user_flag') then
ipar_count = ipar_count + 1
cpar_name(ipar_count) = c_param(1:i_param_chars)
call char2int(iprecip_lapse_rate_user_flag,i_value_chars,
& c_value,c_param(1:i_param_chars))
if (iprecip_lapse_rate_user_flag.ne.0 .and.
& iprecip_lapse_rate_user_flag.ne.1) then
print *,'iprecip_lapse_rate_user_flag not 0 or 1'
stop
endif
endif
if (c_param(1:i_param_chars).eq.'wind_lapse_rate') then
ipar_count = ipar_count + 1
cpar_name(ipar_count) = c_param(1:i_param_chars)
call char2real(wind_lapse_rate,i_value_chars,c_value,
& c_param(1:i_param_chars))
if (wind_lapse_rate.lt.0.0) then
print *,'wind_lapse_rate must be >= 0.0'
stop
endif
endif
if (c_param(1:i_param_chars).eq.'calc_subcanopy_met') then
ipar_count = ipar_count + 1
cpar_name(ipar_count) = c_param(1:i_param_chars)
call char2real(calc_subcanopy_met,i_value_chars,c_value,
& c_param(1:i_param_chars))
if (calc_subcanopy_met.ne.0.0 .and.
& calc_subcanopy_met.ne.1.0) then
print *,'calc_subcanopy_met not 0.0 or 1.0'
stop
endif
endif
if (c_param(1:i_param_chars).eq.'gap_frac') then
ipar_count = ipar_count + 1
cpar_name(ipar_count) = c_param(1:i_param_chars)
call char2real(gap_frac,i_value_chars,c_value,
& c_param(1:i_param_chars))
if (gap_frac.lt.0.0 .or. gap_frac.gt.1.0) then
print *,'gap_frac out of range'
stop
endif
endif
if (c_param(1:i_param_chars).eq.'cloud_frac_factor') then
ipar_count = ipar_count + 1
cpar_name(ipar_count) = c_param(1:i_param_chars)
call char2real(cloud_frac_factor,i_value_chars,c_value,
& c_param(1:i_param_chars))
if (cloud_frac_factor.lt.0.0 .or. cloud_frac_factor.gt.1.0)
& then
print *,'cloud_frac_factor out of range'
stop
endif
endif
if (c_param(1:i_param_chars).eq.'use_shortwave_obs') then
ipar_count = ipar_count + 1
cpar_name(ipar_count) = c_param(1:i_param_chars)
call char2real(use_shortwave_obs,i_value_chars,c_value,
& c_param(1:i_param_chars))
if (use_shortwave_obs.ne.0.0 .and. use_shortwave_obs.ne.1.0)
& then
print *,'use_shortwave_obs not 0.0 or 1.0'
stop
endif
endif
if (c_param(1:i_param_chars).eq.'use_longwave_obs') then
ipar_count = ipar_count + 1
cpar_name(ipar_count) = c_param(1:i_param_chars)
call char2real(use_longwave_obs,i_value_chars,c_value,
& c_param(1:i_param_chars))
if (use_longwave_obs.ne.0.0 .and. use_longwave_obs.ne.1.0)
& then
print *,'use_longwave_obs not 0.0 or 1.0'
stop
endif
endif
if (c_param(1:i_param_chars).eq.'use_sfc_pressure_obs') then
ipar_count = ipar_count + 1
cpar_name(ipar_count) = c_param(1:i_param_chars)
call char2real(use_sfc_pressure_obs,i_value_chars,c_value,
& c_param(1:i_param_chars))
if (use_sfc_pressure_obs.ne.0.0 .and.
& use_sfc_pressure_obs.ne.1.0) then
print *,'use_sfc_pressure_obs not 0.0 or 1.0'
stop
endif
endif
if (c_param(1:i_param_chars).eq.'print_micromet') then
ipar_count = ipar_count + 1
cpar_name(ipar_count) = c_param(1:i_param_chars)
call char2real(print_micromet,i_value_chars,c_value,
& c_param(1:i_param_chars))
if (print_micromet.ne.0.0 .and. print_micromet.ne.1.0) then
print *,'print_micromet not 0.0 or 1.0'
stop
endif
endif
if (c_param(1:i_param_chars).eq.'micromet_output_fname') then
ipar_count = ipar_count + 1
cpar_name(ipar_count) = c_param(1:i_param_chars)
call char2char(micromet_output_fname,c_value,
& i_value_chars,c_param(1:i_param_chars))
endif
c SNOWTRAN-3D MODEL SETUP.
if (c_param(1:i_param_chars).eq.'Utau_t_flag') then
ipar_count = ipar_count + 1
cpar_name(ipar_count) = c_param(1:i_param_chars)
call char2real(Utau_t_flag,i_value_chars,c_value,
& c_param(1:i_param_chars))
if (Utau_t_flag.ne.0.0 .and. Utau_t_flag.ne.1.0) then
print *,'Utau_t_flag not 0.0 or 1.0'
stop
endif
endif
if (c_param(1:i_param_chars).eq.'Utau_t_const') then
ipar_count = ipar_count + 1
cpar_name(ipar_count) = c_param(1:i_param_chars)
call char2real(Utau_t_const,i_value_chars,c_value,
& c_param(1:i_param_chars))
if (Utau_t_const.le.0.0 .and. Utau_t_const.gt.1.0) then
print *,'Utau_t_const out of range'
stop
endif
endif
if (c_param(1:i_param_chars).eq.'subgrid_flag') then
ipar_count = ipar_count + 1
cpar_name(ipar_count) = c_param(1:i_param_chars)
call char2real(subgrid_flag,i_value_chars,c_value,
& c_param(1:i_param_chars))
if (subgrid_flag.ne.0.0 .and. subgrid_flag.ne.1.0) then
print *,'subgrid_flag not 0.0 or 1.0'
stop
endif
endif
if (c_param(1:i_param_chars).eq.'erosion_dist') then
ipar_count = ipar_count + 1
cpar_name(ipar_count) = c_param(1:i_param_chars)
call char2real(erosion_dist,i_value_chars,c_value,
& c_param(1:i_param_chars))
if (erosion_dist.lt.0.0 .or. erosion_dist.gt.100.0) then
print *,'erosion_dist out of range'
stop
endif
endif
if (c_param(1:i_param_chars).eq.'tp_scale') then
ipar_count = ipar_count + 1
cpar_name(ipar_count) = c_param(1:i_param_chars)
call char2real(tp_scale,i_value_chars,c_value,
& c_param(1:i_param_chars))
if (tp_scale.lt.0.0 .or. tp_scale.gt.1.0) then
print *,'tp_scale out of range'
stop
endif
endif
if (c_param(1:i_param_chars).eq.'tabler_dir') then
ipar_count = ipar_count + 1
cpar_name(ipar_count) = c_param(1:i_param_chars)
call char2real(tabler_dir,i_value_chars,c_value,
& c_param(1:i_param_chars))
if (tabler_dir.lt.0.0 .or. tabler_dir.gt.360.0) then
print *,'tabler_dir out of range'
stop
endif
endif
if (c_param(1:i_param_chars).eq.'slope_adjust') then
ipar_count = ipar_count + 1
cpar_name(ipar_count) = c_param(1:i_param_chars)
call char2real(slope_adjust,i_value_chars,c_value,
& c_param(1:i_param_chars))
if (slope_adjust.lt.0.0 .or. slope_adjust.gt.3.0) then
print *,'slope_adjust out of range'
stop
endif
endif
if (c_param(1:i_param_chars).eq.'twolayer_flag') then
ipar_count = ipar_count + 1
cpar_name(ipar_count) = c_param(1:i_param_chars)
call char2real(twolayer_flag,i_value_chars,c_value,
& c_param(1:i_param_chars))
if (twolayer_flag.ne.0.0 .and. twolayer_flag.ne.1.0) then
print *,'twolayer_flag not 0.0 or 1.0'
stop
endif
endif