wrf-fire /wrfv2_fire/external/io_esmf/io_esmf.F90

Language Fortran 90 Lines 1852
MD5 Hash f78ba515f4735502699a0e048e66685d Estimated Cost $41,153 (why?)
Repository git://github.com/jbeezley/wrf-fire.git View Raw File View Project SPDX
   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
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
MODULE module_ext_esmf

! 5.2.0r  USE ESMF_Mod
  USE ESMF
  USE module_esmf_extensions

  IMPLICIT NONE

  TYPE grid_ptr
    TYPE(ESMF_Grid), POINTER :: ptr
    ! use these for error-checking for now...
    INTEGER :: ide_save
    INTEGER :: jde_save
    INTEGER :: kde_save
    LOGICAL :: in_use
  END TYPE grid_ptr

!TODO:  encapsulate this state into a class...  
  INTEGER, PARAMETER :: int_num_handles = 99
  LOGICAL, DIMENSION(int_num_handles) :: okay_to_write, okay_to_read,       &
                                         opened_for_write, opened_for_read, &
                                         int_handle_in_use
  TYPE(grid_ptr) :: grid(int_num_handles)

  ! convenience...
  CHARACTER (256) :: msg

#include "wrf_io_flags.h"
#include "wrf_status_codes.h"

  CONTAINS

    LOGICAL FUNCTION int_valid_handle( handle )
      IMPLICIT NONE
      INTEGER, INTENT(IN) ::  handle
      int_valid_handle = ( handle .ge. 8 .and. handle .le. int_num_handles ) 
    END FUNCTION int_valid_handle

    SUBROUTINE int_get_fresh_handle( retval )
      INTEGER i, retval

      retval = -1
! dont use first 8 handles
      DO i = 8, int_num_handles
        IF ( .NOT. int_handle_in_use(i) )  THEN
          retval = i
          GOTO 33
        ENDIF
      ENDDO
33    CONTINUE
      IF ( retval < 0 )  THEN
        CALL wrf_error_fatal( "io_esmf.F90: int_get_fresh_handle() out of handles")
      ENDIF
      int_handle_in_use(retval) = .TRUE.
    END SUBROUTINE int_get_fresh_handle

! parse comma separated list of VARIABLE=VALUE strings and return the
! value for the matching variable if such exists, otherwise return
! the empty string
SUBROUTINE get_value ( varname , str , retval )
  IMPLICIT NONE
  CHARACTER*(*) ::    varname
  CHARACTER*(*) ::    str
  CHARACTER*(*) ::    retval

  CHARACTER (128) varstr, tstr
  INTEGER i,j,n,varstrn
  LOGICAL nobreak, nobreakouter

  varstr = TRIM(varname)//"="
  varstrn = len(TRIM(varstr))
  n = len(TRIM(str))
  retval = ""
  i = 1
  nobreakouter = .TRUE.
  DO WHILE ( nobreakouter )
    j = 1
    nobreak = .TRUE.
    tstr = ""
    DO WHILE ( nobreak )
      nobreak = .FALSE.
      IF ( i .LE. n ) THEN
        IF (str(i:i) .NE. ',' ) THEN
           tstr(j:j) = str(i:i)
           nobreak = .TRUE.
        ENDIF
      ENDIF
      j = j + 1
      i = i + 1
    ENDDO
    IF ( i .GT. n ) nobreakouter = .FALSE.
    IF ( varstr(1:varstrn) .EQ. tstr(1:varstrn) ) THEN
      retval(1:) = TRIM(tstr(varstrn+1:))
      nobreakouter = .FALSE.
    ENDIF
  ENDDO
  RETURN
END SUBROUTINE get_value


    !--- ioinit
    SUBROUTINE init_module_ext_esmf
      IMPLICIT NONE
      INTEGER :: i
      DO i = 1, int_num_handles
        WRITE( msg,* ) 'init_module_ext_esmf:  calling ioesmf_nullify_grid(',i,')'
        CALL wrf_debug ( 5, TRIM(msg) )
        CALL ioesmf_nullify_grid( i )
      ENDDO
      RETURN
    END SUBROUTINE init_module_ext_esmf


  ! allgather for integers, ESMF_style (since ESMF does not do this yet)
  SUBROUTINE GatherIntegerScalars_ESMF( inval, pe, numprocs, outvals )
    INTEGER, INTENT(IN   ) :: inval                 ! input scalar on this task
    INTEGER, INTENT(IN   ) :: pe                    ! task id
    INTEGER, INTENT(IN   ) :: numprocs              ! number of tasks
    INTEGER, INTENT(  OUT) :: outvals(0:numprocs-1) ! gathered output vector
    ! Local declarations
    TYPE(ESMF_VM) :: vm
    INTEGER(ESMF_KIND_I4) :: allSnd(0:numprocs-1)
    INTEGER(ESMF_KIND_I4) :: allRcv(0:numprocs-1)
    INTEGER :: rc

    ! get current ESMF virtual machine for communication
    CALL ESMF_VMGetCurrent(vm, rc=rc)
    IF ( rc /= ESMF_SUCCESS ) THEN
      WRITE( msg,* ) 'Error in ESMF_VMGetCurrent', &
                     __FILE__ ,                    &
                     ', line',                     &
                     __LINE__
      CALL wrf_error_fatal ( msg )
    ENDIF
    allSnd = 0_ESMF_KIND_I4
    allSnd(pe) = inval
    ! Hack due to lack of ESMF_VMAllGather().  
! 5.2.0r    CALL ESMF_VMAllReduce(vm, allSnd, allRcv, numprocs, ESMF_SUM, rc=rc )
    CALL ESMF_VMAllReduce(vm, allSnd, allRcv, numprocs, ESMF_REDUCE_SUM, rc=rc )
    IF ( rc /= ESMF_SUCCESS ) THEN
      WRITE( msg,* ) 'Error in ESMF_VMAllReduce', &
                     __FILE__ ,                     &
                     ', line',                      &
                     __LINE__
      CALL wrf_error_fatal ( msg )
    ENDIF
    outvals = allRcv

  END SUBROUTINE GatherIntegerScalars_ESMF


END MODULE module_ext_esmf



  ! Indexes for non-staggered variables come in at one-less than
  ! domain dimensions, but io_esmf is currently hacked to use full 
  ! domain spec, so adjust if not staggered.  
  !TODO:  remove this hackery once ESMF can support staggered 
  !TODO:  grids in regional models
  SUBROUTINE ioesmf_endfullhack( numdims, DomainEnd, PatchEnd, Stagger, &
                                 DomainEndFull, PatchEndFull )
    IMPLICIT NONE
    INTEGER,       INTENT(IN   ) :: numdims
    INTEGER,       INTENT(IN   ) :: DomainEnd(numdims)
    INTEGER,       INTENT(IN   ) :: PatchEnd(numdims)
    CHARACTER*(*), INTENT(IN   ) :: Stagger
    INTEGER,       INTENT(  OUT) :: DomainEndFull(numdims)
    INTEGER,       INTENT(  OUT) :: PatchEndFull(numdims)
    LOGICAL, EXTERNAL :: has_char
    DomainEndFull(1:numdims) = DomainEnd(1:numdims)
    IF ( .NOT. has_char( Stagger, 'x' ) ) DomainEndFull(1) = DomainEndFull(1) + 1
    IF ( .NOT. has_char( Stagger, 'y' ) ) DomainEndFull(2) = DomainEndFull(2) + 1
    PatchEndFull(1:numdims) = PatchEnd(1:numdims)
    IF ( .NOT. has_char( Stagger, 'x' ) ) THEN
      IF ( DomainEnd(1) == PatchEnd(1) ) PatchEndFull(1) = DomainEndFull(1)
    ENDIF
    IF ( .NOT. has_char( Stagger, 'y' ) ) THEN
      IF ( DomainEnd(2) == PatchEnd(2) ) PatchEndFull(2) = DomainEndFull(2)
    ENDIF
  END SUBROUTINE ioesmf_endfullhack


  ! Create the ESMF_Grid associated with index DataHandle.  
  !TODO:  Note that periodicity is not supported by this interface.  If 
  !TODO:  periodicity is needed, pass in via SysDepInfo in the call to 
  !TODO:  ext_esmf_ioinit().  
  !TODO:  Note that lat/lon coordinates are not supported by this interface 
  !TODO:  since general curvilinear coordindates (needed for map projections 
  !TODO:  used by WRF such as polar stereographic, mercator, lambert conformal)
  !TODO:  are not supported by ESMF as of ESMF 2.1.1.  Once they are supported, 
  !TODO:  add them via the "sieve" method used in ../io_mcel/.  
  SUBROUTINE ioesmf_create_grid( DataHandle, numdims,    &
                                 MemoryOrder, Stagger,   &
                                 DomainStart, DomainEnd, &
                                 MemoryStart, MemoryEnd, &
                                 PatchStart, PatchEnd )
    USE module_ext_esmf
    IMPLICIT NONE
    INTEGER,       INTENT(IN   ) :: DataHandle
    INTEGER,       INTENT(IN   ) :: numdims
    CHARACTER*(*), INTENT(IN   ) :: MemoryOrder            ! not used yet
    CHARACTER*(*), INTENT(IN   ) :: Stagger
    INTEGER,       INTENT(IN   ) :: DomainStart(numdims), DomainEnd(numdims)
    INTEGER,       INTENT(IN   ) :: MemoryStart(numdims), MemoryEnd(numdims)
    INTEGER,       INTENT(IN   ) :: PatchStart(numdims),  PatchEnd(numdims)
    INTEGER :: DomainEndFull(numdims)
    INTEGER :: PatchEndFull(numdims)

    WRITE( msg,* ) 'DEBUG ioesmf_create_grid:  begin, DataHandle = ', DataHandle
    CALL wrf_debug ( 5, TRIM(msg) )
    ! For now, blindly create a new grid if it does not already exist for 
    ! this DataHandle
!TODO:  Note that this approach will result in duplicate ESMF_Grids when 
!TODO:  io_esmf is used for input and output.  The first ESMF_Grid will 
!TODO:  be associated with the input handle and the second will be associated 
!TODO:  with the output handle.  Fix this if ESMF_Grids are expensive.  
    IF ( .NOT. grid( DataHandle )%in_use ) THEN
      IF ( ASSOCIATED( grid( DataHandle )%ptr ) ) THEN
        CALL wrf_error_fatal ( 'ASSERTION ERROR:  grid(',DataHandle,') should be NULL' )
      ENDIF
      IF ( numdims /= 2 ) THEN
        CALL wrf_error_fatal ( 'ERROR:  only 2D arrays supported so far with io_esmf' )
      ELSE
        WRITE( msg,* ) 'DEBUG ioesmf_create_grid:  creating grid(',DataHandle,')%ptr'
        CALL wrf_debug ( 5, TRIM(msg) )
        ALLOCATE( grid( DataHandle )%ptr )
        grid( DataHandle )%in_use = .TRUE.
        ! The non-staggered variables come in at one-less than
        ! domain dimensions, but io_esmf is currently hacked to use full 
        ! domain spec, so adjust if not staggered.  
        !TODO:  remove this hackery once ESMF can support staggered 
        !TODO:  grids in regional models
        CALL ioesmf_endfullhack( numdims, DomainEnd, PatchEnd, Stagger, &
                                 DomainEndFull, PatchEndFull )
!TODO:  at the moment this is hard-coded for 2D arrays
!TODO:  use MemoryOrder to set these properly!
!TODO:  also, set these once only
!TODO:  maybe even rip this out since it depends on a hack in input_wrf.F ...
        grid( DataHandle )%ide_save = DomainEndFull(1)
        grid( DataHandle )%jde_save = DomainEndFull(2)
        grid( DataHandle )%kde_save = 1
        WRITE( msg,* ) 'DEBUG ioesmf_create_grid:  DomainEndFull = ', DomainEndFull
        CALL wrf_debug ( 5, TRIM(msg) )
        WRITE( msg,* ) 'DEBUG ioesmf_create_grid:  PatchEndFull = ', PatchEndFull
        CALL wrf_debug ( 5, TRIM(msg) )
        CALL wrf_debug ( 5 , 'DEBUG ioesmf_create_grid:  Calling ioesmf_create_grid_int()' )
        CALL ioesmf_create_grid_int( grid( DataHandle )%ptr,     &
                              numdims,                    &
                              DomainStart, DomainEndFull, &
!                              DomainStart, DomainEnd, &
                              MemoryStart, MemoryEnd,     &
!                              PatchStart, PatchEndFull )
                              PatchStart, PatchEnd )
        CALL wrf_debug ( 5 , 'DEBUG ioesmf_create_grid:  back from ioesmf_create_grid_int()' )
        WRITE( msg,* ) 'DEBUG ioesmf_create_grid:  done creating grid(',DataHandle,')%ptr'
        CALL wrf_debug ( 5, TRIM(msg) )
      ENDIF
    ENDIF
    WRITE( msg,* ) 'DEBUG ioesmf_create_grid:  end'
    CALL wrf_debug ( 5, TRIM(msg) )

  END SUBROUTINE ioesmf_create_grid



  ! Create an ESMF_Grid that matches a WRF decomposition.  
  !TODO:  Note that periodicity is not supported by this interface.  If 
  !TODO:  periodicity is needed, pass in via SysDepInfo in the call to 
  !TODO:  ext_esmf_ioinit().  
  !TODO:  Note that lat/lon coordinates are not supported by this interface 
  !TODO:  since general curvilinear coordindates (needed for map projections 
  !TODO:  used by WRF such as polar stereographic, mercator, lambert conformal)
  !TODO:  are not supported by ESMF as of ESMF 2.1.1.  Once they are supported, 
  !TODO:  add them via the "sieve" method used in ../io_mcel/.  
  !TODO:  Note that DomainEnd and PatchEnd must currently include "extra" 
  !TODO:  points for non-periodic staggered arrays.  It may be possible to 
  !TODO:  remove this hackery once ESMF can support staggered 
  !TODO:  grids in regional models.  
  SUBROUTINE ioesmf_create_grid_int( esmfgrid, numdims,      &
                              DomainStart, DomainEnd, &
                              MemoryStart, MemoryEnd, &
                              PatchStart, PatchEnd )
    USE module_ext_esmf
    IMPLICIT NONE
    TYPE(ESMF_Grid), INTENT(INOUT) :: esmfgrid
    INTEGER,         INTENT(IN   ) :: numdims
    INTEGER,         INTENT(IN   ) :: DomainStart(numdims), DomainEnd(numdims)
    INTEGER,         INTENT(IN   ) :: MemoryStart(numdims), MemoryEnd(numdims)
    INTEGER,         INTENT(IN   ) :: PatchStart(numdims),  PatchEnd(numdims)
    ! Local declarations
    INTEGER :: numprocs     ! total number of tasks
    INTEGER, ALLOCATABLE :: ipatchStarts(:), jpatchStarts(:)
    INTEGER :: numprocsX    ! number of tasks in "i" dimension
    INTEGER :: numprocsY    ! number of tasks in "j" dimension
    INTEGER, ALLOCATABLE :: permuteTasks(:)
    INTEGER :: globalXcount ! staggered domain count in "i" dimension
    INTEGER :: globalYcount ! staggered domain count in "j" dimension
    INTEGER :: myXstart     ! task-local start in "i" dimension
    INTEGER :: myYstart     ! task-local start in "j" dimension
    INTEGER :: myXend       ! staggered task-local end in "i" dimension
    INTEGER :: myYend       ! staggered task-local end in "j" dimension
    INTEGER, ALLOCATABLE :: allXStart(:)
    INTEGER, ALLOCATABLE :: allXCount(:)
    INTEGER, ALLOCATABLE :: dimXCount(:)
    INTEGER, ALLOCATABLE :: allYStart(:)
    INTEGER, ALLOCATABLE :: allYCount(:)
    INTEGER, ALLOCATABLE :: dimYCount(:)
    REAL(ESMF_KIND_R8), ALLOCATABLE :: coordX(:)
    REAL(ESMF_KIND_R8), ALLOCATABLE :: coordY(:)
    INTEGER, ALLOCATABLE :: cellCounts(:,:)
    INTEGER, ALLOCATABLE :: globalStarts(:,:)
    INTEGER :: rc, debug_level
    INTEGER :: myXcount      ! task-local count in "i" dimension
    INTEGER :: myYcount      ! task-local count in "j" dimension
    INTEGER :: globalCellCounts(2)
    INTEGER :: numprocsXY(2)
    INTEGER :: myPE, i, j, pe, is, ie, js, je, is_min, js_min, ie_max, je_max
    INTEGER :: ips, ipe, jps, jpe, ids, ide, jds, jde
    TYPE(ESMF_VM) :: vm
    TYPE(ESMF_DELayout) :: taskLayout
    REAL(ESMF_KIND_R8), DIMENSION(:), POINTER :: coordX2d, coordY2d
    INTEGER, DIMENSION(3) :: ubnd, lbnd
    CHARACTER (32) :: gridname
    INTEGER, SAVE :: gridID = 0

      CALL get_wrf_debug_level( debug_level )

      CALL wrf_debug ( 5 , 'DEBUG ioesmf_create_grid_int:  begin...' )
      WRITE( msg,* ) 'DEBUG ioesmf_create_grid_int:  numdims = ',numdims
      CALL wrf_debug ( 5 , TRIM(msg) )
      WRITE( msg,* ) 'DEBUG ioesmf_create_grid_int:  DomainStart = ',DomainStart(1:numdims)
      CALL wrf_debug ( 5 , TRIM(msg) )
      WRITE( msg,* ) 'DEBUG ioesmf_create_grid_int:  DomainEnd = ',DomainEnd(1:numdims)
      CALL wrf_debug ( 5 , TRIM(msg) )
      WRITE( msg,* ) 'DEBUG ioesmf_create_grid_int:  MemoryStart = ',MemoryStart(1:numdims)
      CALL wrf_debug ( 5 , TRIM(msg) )
      WRITE( msg,* ) 'DEBUG ioesmf_create_grid_int:  MemoryEnd = ',MemoryEnd(1:numdims)
      CALL wrf_debug ( 5 , TRIM(msg) )
      WRITE( msg,* ) 'DEBUG ioesmf_create_grid_int:  PatchStart = ',PatchStart(1:numdims)
      CALL wrf_debug ( 5 , TRIM(msg) )
      WRITE( msg,* ) 'DEBUG ioesmf_create_grid_int:  PatchEnd = ',PatchEnd(1:numdims)
      CALL wrf_debug ( 5 , TRIM(msg) )
      ! First, determine number of tasks and number of tasks in each decomposed 
      ! dimension (ESMF 2.2.0 is restricted to simple task layouts)
      ! get current ESMF virtual machine and inquire...  
      CALL ESMF_VMGetCurrent(vm, rc=rc)
      IF ( rc /= ESMF_SUCCESS ) THEN
        WRITE( msg,* ) 'Error in ESMF_VMGetCurrent', &
                       __FILE__ ,                    &
                       ', line',                     &
                       __LINE__
        CALL wrf_error_fatal ( msg )
      ENDIF
!TODO:  Note (PET==MPI process) assumption here.  This is OK in ESMF 
!TODO:  2.2.0 but may change in a future ESMF release.  If so, we will 
!TODO:  need another way to do this.  May want to grab mpiCommunicator 
!TODO:  instead and ask it directly for number of MPI tasks.  Unless this 
!TODO:  is a serial run...
      CALL ESMF_VMGet(vm, petCount=numprocs, localPet=myPE, rc=rc)
      IF ( rc /= ESMF_SUCCESS ) THEN
        WRITE( msg,* ) 'Error in ESMF_VMGet', &
                       __FILE__ ,             &
                       ', line',              &
                       __LINE__
        CALL wrf_error_fatal ( msg )
      ENDIF
      ALLOCATE( ipatchStarts(0:numprocs-1), jpatchStarts(0:numprocs-1) )
      CALL GatherIntegerScalars_ESMF(PatchStart(1), myPE, numprocs, ipatchStarts)
      CALL GatherIntegerScalars_ESMF(PatchStart(2), myPE, numprocs, jpatchStarts)
      numprocsX = 0
      numprocsY = 0
      DO pe = 0, numprocs-1
        IF ( PatchStart(1) == ipatchStarts(pe) ) THEN
          numprocsY = numprocsY + 1
        ENDIF
        IF ( PatchStart(2) == jpatchStarts(pe) ) THEN
          numprocsX = numprocsX + 1
        ENDIF
      ENDDO
      DEALLOCATE( ipatchStarts, jpatchStarts )
WRITE( msg,* ) 'DEBUG ioesmf_create_grid_int:  numprocsX = ',numprocsX
CALL wrf_debug ( 5 , TRIM(msg) )
WRITE( msg,* ) 'DEBUG ioesmf_create_grid_int:  numprocsY = ',numprocsY
CALL wrf_debug ( 5 , TRIM(msg) )
      ! sanity check
      IF ( numprocs /= numprocsX*numprocsY ) THEN
        CALL wrf_error_fatal ( 'ASSERTION FAILED:  numprocs /= numprocsX*numprocsY' )
      ENDIF
      ! Next, create ESMF_DELayout
      numprocsXY = (/ numprocsX, numprocsY /)
!TODO:  1-to-1 DE to PET mapping is assumed below...  
      ALLOCATE( permuteTasks(0:numprocs-1) )
      pe = 0
      DO j = 0, numprocsY-1
        DO i = 0, numprocsX-1
! NOTE:  seems to work both ways...  
! (/ 0 2 1 3 /)
!        permuteTasks(pe) = (i*numprocsY) + j
! (/ 0 1 2 3 /)
        permuteTasks(pe) = pe
        pe = pe + 1
        ENDDO
      ENDDO
      WRITE( msg,* ) 'DEBUG ioesmf_create_grid_int:  numprocsXY = ',numprocsXY
      CALL wrf_debug ( 5 , TRIM(msg) )
      WRITE( msg,* ) 'DEBUG ioesmf_create_grid_int:  permuteTasks = ',permuteTasks
      CALL wrf_debug ( 5 , TRIM(msg) )
      CALL wrf_debug ( 5 , 'DEBUG ioesmf_create_grid_int:  calling ESMF_DELayoutCreate' )
      taskLayout = ESMF_DELayoutCreate( vm, numprocsXY, petList=permuteTasks, rc=rc ) 
      IF ( rc /= ESMF_SUCCESS ) THEN
        WRITE( msg,* ) 'Error in ESMF_DELayoutCreate', &
                       __FILE__ ,                      &
                       ', line',                       &
                       __LINE__
        CALL wrf_error_fatal ( msg )
      ENDIF
      CALL wrf_debug ( 5 , 'DEBUG ioesmf_create_grid_int:  back from ESMF_DELayoutCreate' )
      DEALLOCATE( permuteTasks )

      CALL wrf_debug ( 5 , 'DEBUG ioesmf_create_grid_int:  calling ESMF_DELayoutPrint 1' )
      IF ( 5 .LE. debug_level ) THEN
        CALL ESMF_DELayoutPrint( taskLayout, rc=rc )
      ENDIF
      CALL wrf_debug ( 5 , 'DEBUG ioesmf_create_grid_int:  back from ESMF_DELayoutPrint 1' )

! Compute the dimensions for the ESMF grid, using WRF's non-staggered dimensions
! This is as of ESMF v3, JM 20080715

      ! the [ij][dp][se] bits are for convenience...  
      ids = DomainStart(1); ide = DomainEnd(1); 
      jds = DomainStart(2); jde = DomainEnd(2); 
      ips = PatchStart(1);  ipe = PatchEnd(1); 
      jps = PatchStart(2);  jpe = PatchEnd(2); 
      globalXcount = ide - ids  ! in other words, the number of points from ids to ide-1 inclusive
      globalYcount = jde - jds  ! in other words, the number of points from jds to jde-1 inclusive
      ! task-local numbers of points in patch for staggered arrays
      myXstart = ips
      myYstart = jps
      myXend = MIN(ipe,ide-1)
      myYend = MIN(jpe,jde-1)
      myXcount = myXend - myXstart + 1
      myYcount = myYend - myYstart + 1
      ! gather task-local information on all tasks since 
      ! ESMF_GridDistribute[Block] interface require global knowledge to set up 
      ! decompositions
      ! Recall that coordX and coordY are coordinates of *vertices*, not cell centers.  
      ! Thus they must be 1 bigger than the number of cells.  
      ALLOCATE( allXStart(0:numprocs-1),  allXCount(0:numprocs-1),  &
                allYStart(0:numprocs-1),  allYCount(0:numprocs-1),  &
                dimXCount(0:numprocsX-1), dimYCount(0:numprocsY-1), &
                coordX(globalXcount+1),   coordY(globalYcount+1) )
      CALL GatherIntegerScalars_ESMF(myXcount, myPE, numprocs, allXCount)
      CALL GatherIntegerScalars_ESMF(myXstart, myPE, numprocs, allXStart)
      CALL GatherIntegerScalars_ESMF(myYcount, myPE, numprocs, allYCount)
      CALL GatherIntegerScalars_ESMF(myYstart, myPE, numprocs, allYStart)

      !TODO:  ESMF 2.x does not support mercator, polar-stereographic, or 
      !TODO:  lambert-conformal projections.  Therefore, we're using fake 
      !TODO:  coordinates here.  This means that WRF will either have to 
      !TODO:  couple to models that run on the same coorindate such that 
      !TODO:  grid points are co-located or something else will have to 
      !TODO:  perform the inter-grid interpolation computations.  Replace 
      !TODO:  this once ESMF is upgraded to support the above map 
      !TODO:  projections (via general curvilinear coordinates).  
      CALL wrf_message( 'WARNING:  Using artificial coordinates for ESMF coupling.' )
      CALL wrf_message( 'WARNING:  ESMF coupling interpolation will be incorrect' )
      CALL wrf_message( 'WARNING:  unless grid points in the coupled components' )
      CALL wrf_message( 'WARNING:  are co-located.  This limitation will be removed' )
      CALL wrf_message( 'WARNING:  once ESMF coupling supports generalized' )
      CALL wrf_message( 'WARNING:  curvilinear coordintates needed to represent' )
      CALL wrf_message( 'WARNING:  common map projections used by WRF and other' )
      CALL wrf_message( 'WARNING:  regional models.' )
      ! Note that ESMF defines coordinates at *vertices*
      coordX(1) = 0.0
      DO i = 2, SIZE(coordX)
        coordX(i) = coordX(i-1) + 1.0
      ENDDO
      coordY(1) = 0.0
      DO j = 2, SIZE(coordY)
        coordY(j) = coordY(j-1) + 1.0
      ENDDO
      ! Create an ESMF_Grid
      ! For now we create only a 2D grid suitable for simple coupling of 2D 
      ! surface fields.  Later, create and subset one or more 3D grids.  
!TODO:  Pass staggering info into this routine once ESMF can support staggered 
!TODO:  grids.  For now, it is hard-coded for WRF-ARW.  
      gridID = gridID + 1
      WRITE ( gridname,'(a,i0)' ) 'WRF_grid_', gridID

CALL wrf_debug ( 5 , 'DEBUG WRF:  Calling ESMF_GridCreate' )
WRITE( msg,* ) 'DEBUG WRF:  SIZE(coordX) = ', SIZE(coordX)
CALL wrf_debug ( 5 , TRIM(msg) )
WRITE( msg,* ) 'DEBUG WRF:  SIZE(coordY) = ', SIZE(coordY)
CALL wrf_debug ( 5 , TRIM(msg) )
DO i = 1, SIZE(coordX)
  WRITE( msg,* ) 'DEBUG WRF:  coord1(',i,') = ', coordX(i)
  CALL wrf_debug ( 5 , TRIM(msg) )
ENDDO
DO j = 1, SIZE(coordY)
  WRITE( msg,* ) 'DEBUG WRF:  coord2(',j,') = ', coordY(j)
  CALL wrf_debug ( 5 , TRIM(msg) )
ENDDO
!WRITE( msg,* ) 'DEBUG WRF:  horzstagger = ', ESMF_GRID_HORZ_STAGGER_C_SW
!CALL wrf_debug ( 5 , TRIM(msg) )
WRITE( msg,* ) 'DEBUG WRF:  name = ', TRIM(gridname)
CALL wrf_debug ( 5 , TRIM(msg) )

      ! distribute the ESMF_Grid
      ! ignore repeated values
      is_min = MINVAL(allXStart)
      js_min = MINVAL(allYStart)
      i = 0
      j = 0
      WRITE( msg,* ) 'DEBUG:  is_min = ',is_min,'  allXStart = ',allXStart
      CALL wrf_debug ( 5 , TRIM(msg) )
      WRITE( msg,* ) 'DEBUG:  js_min = ',js_min,'  allYStart = ',allYStart
      CALL wrf_debug ( 5 , TRIM(msg) )
      WRITE( msg,* ) 'DEBUG:  allXCount = ',allXCount
      CALL wrf_debug ( 5 , TRIM(msg) )
      WRITE( msg,* ) 'DEBUG:  allYCount = ',allYCount
      CALL wrf_debug ( 5 , TRIM(msg) )
      DO pe = 0, numprocs-1
        IF (allXStart(pe) == is_min) THEN
          IF (j >= numprocsY) THEN
            WRITE( msg,* ) 'ASSERTION FAILED in ESMF_GridCreate', &
                           __FILE__ ,                                   &
                           ', line',                                    &
                           __LINE__
            CALL wrf_error_fatal ( msg )
          ENDIF
      WRITE( msg,* ) 'DEBUG:  dimYCount(',j,') == allYCount(',pe,')'
      CALL wrf_debug ( 5 , TRIM(msg) )
          dimYCount(j) = allYCount(pe)
          j = j + 1
        ENDIF
        IF (allYStart(pe) == js_min) THEN
          IF (i >= numprocsX) THEN
            WRITE( msg,* ) 'ASSERTION FAILED in ESMF_GridCreate', &
                           __FILE__ ,                                   &
                           ', line',                                    &
                           __LINE__
            CALL wrf_error_fatal ( msg )
          ENDIF
      WRITE( msg,* ) 'DEBUG:  dimXCount(',i,') == allXCount(',pe,')'
      CALL wrf_debug ( 5 , TRIM(msg) )
          dimXCount(i) = allXCount(pe)
          i = i + 1
        ENDIF
      ENDDO
      WRITE( msg,* ) 'DEBUG:  i = ',i,'  dimXCount = ',dimXCount
      CALL wrf_debug ( 5 , TRIM(msg) )
      WRITE( msg,* ) 'DEBUG:  j = ',j,'  dimYCount = ',dimYCount
      CALL wrf_debug ( 5 , TRIM(msg) )

#if 0
      esmfgrid = ESMF_GridCreateHorzXY(                     &
                   coord1=coordX, coord2=coordY,            &
                   horzstagger=ESMF_GRID_HORZ_STAGGER_C_SW, &
!TODO:  use this for 3D Grids once it is stable
!                  coordorder=ESMF_COORD_ORDER_XZY,         &
                   name=TRIM(gridname), rc=rc )
#else
! based on example in 3.1 ref man sec 23.2.5, Creating an Irregularly 
! Distributed Rectilinear Grid with a Non-Distributed Vertical Dimension
      !esmfgrid = ESMF_GridCreateShapeTile(  &
!write(0,*)'calling ESMF_GridCreateShapeTile for grid named ',trim(gridname)
!write(0,*)'calling ESMF_GridCreateShapeTile dimXCount ',dimXCount
!write(0,*)'calling ESMF_GridCreateShapeTile dimYCount ',dimYCount
! 5.2.0r      esmfgrid = ESMF_GridCreateShapeTile(  &
      esmfgrid = ESMF_GridCreate(  &
                 countsPerDEDim1=dimXCount , &
                 countsPerDEDim2=dimYcount , &
                 coordDep1=(/1/) , &
                 coordDep2=(/2/) , &
                 indexflag=ESMF_INDEX_GLOBAL, & ! use global indices
                 name=TRIM(gridname), &
                 rc = rc )

      CALL ESMF_GridAddCoord(esmfgrid, &
                 staggerloc=ESMF_STAGGERLOC_CENTER, &
                 rc=rc)


      CALL ESMF_GridGetCoord(esmfgrid,coordDim=1,localDE=0, &
                 staggerloc=ESMF_STAGGERLOC_CENTER, &
                 computationalLBound=lbnd,computationalUBound=ubnd, &
                 farrayptr=coordX2d, &
                 rc=rc)

      DO i=lbnd(1),ubnd(1)
        coordX2d(i) = (i-1)*1.0
      ENDDO
      CALL ESMF_GridGetCoord(esmfgrid,coordDim=2,localDE=0, &
                 staggerloc=ESMF_STAGGERLOC_CENTER, &
                 computationalLBound=lbnd,computationalUBound=ubnd, &
                 farrayptr=coordY2d,                             &
                 rc=rc)
      DO i=lbnd(1),ubnd(1)
        coordY2d(i) = (i-1)*1.0
      ENDDO
                 
                 
#endif
      IF ( rc /= ESMF_SUCCESS ) THEN
        WRITE( msg,* ) 'Error in ESMF_GridCreate', &
                       __FILE__ ,                        &
                       ', line',                         &
                       __LINE__
        CALL wrf_error_fatal ( msg )
      ENDIF
CALL wrf_debug ( 5 , 'DEBUG WRF:  back OK from ESMF_GridCreate' )

      CALL wrf_debug ( 5 , 'DEBUG ioesmf_create_grid_int:  calling ESMF_DELayoutPrint 2' )
      IF ( 5 .LE. debug_level ) THEN
        CALL ESMF_DELayoutPrint( taskLayout, rc=rc )
      ENDIF
      CALL wrf_debug ( 5 , 'DEBUG ioesmf_create_grid_int:  back from ESMF_DELayoutPrint 2' )

#if 0
      CALL ESMF_GridDistribute( esmfgrid,                  &
                                delayout=taskLayout,       &
                                countsPerDEDim1=dimXCount, &
                                countsPerDEDim2=dimYCount, &
                                rc=rc )
      IF ( rc /= ESMF_SUCCESS ) THEN
        WRITE( msg,* ) 'Error in ESMF_GridDistribute ', &
                       __FILE__ ,                       &
                       ', line ',                       &
                       __LINE__ ,                       &
                       ', error code = ',rc
        CALL wrf_error_fatal ( msg )
      ENDIF
#endif
CALL wrf_debug ( 5 , 'DEBUG WRF:  Calling ESMF_GridValidate()' )
      CALL ESMF_GridValidate( esmfgrid, rc=rc )
      IF ( rc /= ESMF_SUCCESS ) THEN
        WRITE( msg,* ) 'Error in ESMF_GridValidate ',   &
                       __FILE__ ,                       &
                       ', line ',                       &
                       __LINE__ ,                       &
                       ', error code = ',rc
        CALL wrf_error_fatal ( msg )
      ENDIF

CALL wrf_debug ( 5 , 'DEBUG WRF:  back OK from ESMF_GridValidate()' )
      DEALLOCATE( allXStart, allXCount, allYStart, allYCount, &
                  dimXCount, dimYCount, coordX, coordY )

#if 0
      ! Print out the ESMF decomposition info for debug comparison with WRF 
      ! decomposition info.  
      ALLOCATE( cellCounts(0:numprocs-1,2), globalStarts(0:numprocs-1,2) )

      ! extract information about staggered grids for debugging
      CALL ESMF_GridGet( esmfgrid,                               &
                         horzrelloc=ESMF_CELL_WFACE,             &
                         globalStartPerDEPerDim=globalStarts,    &
                         cellCountPerDEPerDim=cellCounts,        &
                         globalCellCountPerDim=globalCellCounts, &
                         rc=rc )
      IF ( rc /= ESMF_SUCCESS ) THEN
        WRITE( msg,* ) 'Error in ESMF_GridGet', &
                       __FILE__ ,               &
                       ', line',                &
                       __LINE__
        CALL wrf_error_fatal ( msg )
      ENDIF
! note that global indices in ESMF_Grid always start at zero
      WRITE( msg,* ) 'DEBUG:  ESMF     staggered     ips = ',1+globalStarts(myPE,1)
      CALL wrf_debug ( 5 , TRIM(msg) )
      WRITE( msg,* ) 'DEBUG:  ESMF     staggered     ipe = ',1+globalStarts(myPE,1) + cellCounts(myPE,1) - 1
      CALL wrf_debug ( 5 , TRIM(msg) )
      WRITE( msg,* ) 'DEBUG:  ESMF     staggered i count = ',  cellCounts(myPE,1)
      CALL wrf_debug ( 5 , TRIM(msg) )
      CALL ESMF_GridGet( esmfgrid,                               &
                         horzrelloc=ESMF_CELL_SFACE,             &
                         globalStartPerDEPerDim=globalStarts,    &
                         cellCountPerDEPerDim=cellCounts,        &
                         globalCellCountPerDim=globalCellCounts, &
                         rc=rc )
      IF ( rc /= ESMF_SUCCESS ) THEN
        WRITE( msg,* ) 'Error in ESMF_GridGet', &
                       __FILE__ ,               &
                       ', line',                &
                       __LINE__
        CALL wrf_error_fatal ( msg )
      ENDIF
! note that global indices in ESMF_Grid always start at zero
      WRITE( msg,* ) 'DEBUG:  ESMF     staggered     jps = ',1+globalStarts(myPE,2)
      CALL wrf_debug ( 5 , TRIM(msg) )
      WRITE( msg,* ) 'DEBUG:  ESMF     staggered     jpe = ',1+globalStarts(myPE,2) + cellCounts(myPE,2) - 1
      CALL wrf_debug ( 5 , TRIM(msg) )
      WRITE( msg,* ) 'DEBUG:  ESMF     staggered j count = ',  cellCounts(myPE,2)
      CALL wrf_debug ( 5 , TRIM(msg) )

      DEALLOCATE( cellCounts, globalStarts )

      CALL wrf_debug ( 100 , 'DEBUG ioesmf_create_grid_int:  print esmfgrid BEGIN...' )
      IF ( 100 .LE. debug_level ) THEN
        CALL ESMF_GridPrint( esmfgrid, rc=rc )
        IF ( rc /= ESMF_SUCCESS ) THEN
          WRITE( msg,* ) 'Error in ESMF_GridPrint', &
                         __FILE__ ,                        &
                         ', line',                         &
                         __LINE__
          CALL wrf_error_fatal ( msg )
        ENDIF
      ENDIF
      CALL wrf_debug ( 100 , 'DEBUG ioesmf_create_grid_int:  print esmfgrid END' )

#endif
      CALL wrf_debug ( 5 , 'DEBUG ioesmf_create_grid_int:  returning...' )

  END SUBROUTINE ioesmf_create_grid_int



  ! Destroy the ESMF_Grid associated with index DataHandle.  
  ! grid( DataHandle )%ptr is DEALLOCATED (NULLIFIED)
  SUBROUTINE ioesmf_destroy_grid( DataHandle )
    USE module_ext_esmf
    IMPLICIT NONE
    INTEGER, INTENT(IN   ) :: DataHandle
    ! Local declarations
    INTEGER :: id, rc
    TYPE(ESMF_DELayout) :: taskLayout
    LOGICAL :: noneLeft
    IF ( grid( DataHandle )%in_use ) THEN
#if 0
WRITE( msg,* ) 'DEBUG:  ioesmf_destroy_grid( ',DataHandle,' ) begin...'
CALL wrf_debug ( 5 , TRIM(msg) )
      CALL ESMF_GridGet( grid( DataHandle )%ptr, delayout=taskLayout, rc=rc )
      IF ( rc /= ESMF_SUCCESS ) THEN
        WRITE( msg,* ) 'Error in ESMF_GridGet', &
                       __FILE__ ,               &
                       ', line',                &
                       __LINE__
        CALL wrf_error_fatal ( msg )
      ENDIF
      ! I "know" I created this...  (not really, but ESMF cannot tell me!)
      CALL ESMF_DELayoutDestroy( taskLayout, rc=rc )
      IF ( rc /= ESMF_SUCCESS ) THEN
        WRITE( msg,* ) 'Error in ESMF_DELayoutDestroy', &
                       __FILE__ ,                       &
                       ', line',                        &
                       __LINE__
        CALL wrf_error_fatal ( msg )
      ENDIF
#endif
      CALL ESMF_GridDestroy( grid( DataHandle )%ptr, rc=rc )
      IF ( rc /= ESMF_SUCCESS ) THEN
        WRITE( msg,* ) 'Error in ESMF_GridDestroy', &
                       __FILE__ ,                   &
                       ', line',                    &
                       __LINE__
        CALL wrf_error_fatal ( msg )
      ENDIF
      DEALLOCATE( grid( DataHandle )%ptr )
      CALL ioesmf_nullify_grid( DataHandle )
WRITE( msg,* ) 'DEBUG:  ioesmf_destroy_grid( ',DataHandle,' ) end'
CALL wrf_debug ( 5 , TRIM(msg) )
    ENDIF

  END SUBROUTINE ioesmf_destroy_grid


  ! Nullify the grid_ptr associated with index DataHandle.  
  ! grid( DataHandle )%ptr must not be associated
  ! DataHandle must be in a valid range
  SUBROUTINE ioesmf_nullify_grid( DataHandle )
    USE module_ext_esmf
    IMPLICIT NONE
    INTEGER, INTENT(IN   ) :: DataHandle
    NULLIFY( grid( DataHandle )%ptr )
    grid( DataHandle )%in_use = .FALSE.
    grid( DataHandle )%ide_save = 0
    grid( DataHandle )%jde_save = 0
    grid( DataHandle )%kde_save = 0
  END SUBROUTINE ioesmf_nullify_grid


!TODO:  use generic explicit interfaces and remove duplication
!TODO:  use cpp to remove duplication
 SUBROUTINE ioesmf_extract_data_real( data_esmf_real, Field,      &
                                      ips, ipe, jps, jpe, kps, kpe, &
                                      ims, ime, jms, jme, kms, kme )
   USE module_ext_esmf
   IMPLICIT NONE
   INTEGER,            INTENT(IN   ) :: ips, ipe, jps, jpe, kps, kpe
   INTEGER,            INTENT(IN   ) :: ims, ime, jms, jme, kms, kme
   REAL(ESMF_KIND_R4), INTENT(IN   ) :: data_esmf_real( ips:ipe, jps:jpe )
   REAL,               INTENT(  OUT) :: Field( ims:ime, jms:jme, kms:kme )
   Field( ips:ipe, jps:jpe, kms ) = data_esmf_real( ips:ipe, jps:jpe )
 END SUBROUTINE ioesmf_extract_data_real


!TODO:  use cpp to remove duplication
 SUBROUTINE ioesmf_extract_data_int( data_esmf_int, Field,         &
                                     ips, ipe, jps, jpe, kps, kpe, &
                                     ims, ime, jms, jme, kms, kme )
   USE module_ext_esmf
   IMPLICIT NONE
   INTEGER,               INTENT(IN   ) :: ips, ipe, jps, jpe, kps, kpe
   INTEGER,               INTENT(IN   ) :: ims, ime, jms, jme, kms, kme
   INTEGER(ESMF_KIND_I4), INTENT(IN   ) :: data_esmf_int( ips:ipe, jps:jpe )
   INTEGER,               INTENT(  OUT) :: Field( ims:ime, jms:jme, kms:kme )
   Field( ips:ipe, jps:jpe, kms ) = data_esmf_int( ips:ipe, jps:jpe )
 END SUBROUTINE ioesmf_extract_data_int


!TODO:  use cpp to remove duplication
 SUBROUTINE ioesmf_insert_data_real( Field, data_esmf_real,        &
                                     ips, ipe, jps, jpe, kps, kpe, &
                                     ims, ime, jms, jme, kms, kme )
   USE module_ext_esmf
   IMPLICIT NONE
   INTEGER,               INTENT(IN   ) :: ips, ipe, jps, jpe, kps, kpe
   INTEGER,               INTENT(IN   ) :: ims, ime, jms, jme, kms, kme
   REAL,                  INTENT(IN   ) :: Field( ims:ime, jms:jme, kms:kme )
   REAL(ESMF_KIND_R4),    INTENT(  OUT) :: data_esmf_real( ips:ipe, jps:jpe )
   !TODO:  Remove this hack once we no longer have to store non-staggered 
   !TODO:  arrays in space dimensioned for staggered arrays.  
   data_esmf_real = 0.0_ESMF_KIND_R4
   data_esmf_real( ips:ipe, jps:jpe ) = Field( ips:ipe, jps:jpe, kms )
 END SUBROUTINE ioesmf_insert_data_real


!TODO:  use cpp to remove duplication
 SUBROUTINE ioesmf_insert_data_int( Field, data_esmf_int,         &
                                    ips, ipe, jps, jpe, kps, kpe, &
                                    ims, ime, jms, jme, kms, kme )
   USE module_ext_esmf
   IMPLICIT NONE
   INTEGER,               INTENT(IN   ) :: ips, ipe, jps, jpe, kps, kpe
   INTEGER,               INTENT(IN   ) :: ims, ime, jms, jme, kms, kme
   INTEGER,               INTENT(IN   ) :: Field( ims:ime, jms:jme, kms:kme )
   INTEGER(ESMF_KIND_I4), INTENT(  OUT) :: data_esmf_int( ips:ipe, jps:jpe )
   !TODO:  Remove this hack once we no longer have to store non-staggered 
   !TODO:  arrays in space dimensioned for staggered arrays.  
   data_esmf_int = 0.0_ESMF_KIND_I4
   data_esmf_int( ips:ipe, jps:jpe ) = Field( ips:ipe, jps:jpe, kms )
 END SUBROUTINE ioesmf_insert_data_int


!--------------

SUBROUTINE ext_esmf_ioinit( SysDepInfo, Status )
  USE module_ext_esmf
  IMPLICIT NONE
  CHARACTER*(*), INTENT(IN) :: SysDepInfo
  INTEGER Status
  CALL init_module_ext_esmf
  Status = 0 
END SUBROUTINE ext_esmf_ioinit

!--- open_for_read 
SUBROUTINE ext_esmf_open_for_read ( FileName , Comm_compute, Comm_io, SysDepInfo, &
                                    DataHandle , Status )
  USE module_ext_esmf
  IMPLICIT NONE
  CHARACTER*(*) :: FileName
  INTEGER ,       INTENT(IN)  :: Comm_compute , Comm_io
  CHARACTER*(*) :: SysDepInfo
  INTEGER ,       INTENT(OUT) :: DataHandle
  INTEGER ,       INTENT(OUT) :: Status
  CALL wrf_debug(1,'ext_esmf_open_for_read not supported yet')
  Status = WRF_WARN_NOTSUPPORTED
  RETURN  
END SUBROUTINE ext_esmf_open_for_read


!--- inquire_opened
SUBROUTINE ext_esmf_inquire_opened ( DataHandle, FileName , FileStatus, Status )
  USE module_ext_esmf
  IMPLICIT NONE
  INTEGER ,       INTENT(IN)  :: DataHandle
  CHARACTER*(*) :: FileName
  INTEGER ,       INTENT(OUT) :: FileStatus
  INTEGER ,       INTENT(OUT) :: Status

  Status = 0

  WRITE( msg,* ) 'DEBUG ext_esmf_inquire_opened:  begin, DataHandle = ', DataHandle
  CALL wrf_debug ( 5 , TRIM(msg) )
  WRITE( msg,* ) 'DEBUG ext_esmf_inquire_opened:  int_valid_handle(',DataHandle,') = ', &
                 int_valid_handle( DataHandle )
  CALL wrf_debug ( 5 , TRIM(msg) )
  WRITE( msg,* ) 'DEBUG ext_esmf_inquire_opened:  int_handle_in_use(',DataHandle,') = ', &
                 int_handle_in_use( DataHandle )
  CALL wrf_debug ( 5 , TRIM(msg) )
  WRITE( msg,* ) 'DEBUG ext_esmf_inquire_opened:  opened_for_read(',DataHandle,') = ', &
                 opened_for_read( DataHandle )
  CALL wrf_debug ( 5 , TRIM(msg) )
  WRITE( msg,* ) 'DEBUG ext_esmf_inquire_opened:  okay_to_read(',DataHandle,') = ', &
                 okay_to_read( DataHandle )
  CALL wrf_debug ( 5 , TRIM(msg) )
  WRITE( msg,* ) 'DEBUG ext_esmf_inquire_opened:  opened_for_write(',DataHandle,') = ', &
                 opened_for_write( DataHandle )
  CALL wrf_debug ( 5 , TRIM(msg) )
  WRITE( msg,* ) 'DEBUG ext_esmf_inquire_opened:  okay_to_write(',DataHandle,') = ', &
                 okay_to_write( DataHandle )
  CALL wrf_debug ( 5 , TRIM(msg) )

!TODO:  need to cache file name and match with FileName argument and return 
!TODO:  FileStatus = WRF_FILE_NOT_OPENED if they do not match

  FileStatus = WRF_FILE_NOT_OPENED
  IF ( int_valid_handle( DataHandle ) ) THEN
    IF ( int_handle_in_use( DataHandle ) ) THEN
      IF ( opened_for_read ( DataHandle ) ) THEN
        IF ( okay_to_read( DataHandle ) ) THEN
           FileStatus = WRF_FILE_OPENED_FOR_READ
        ELSE
           FileStatus = WRF_FILE_OPENED_NOT_COMMITTED
        ENDIF
      ELSE IF ( opened_for_write( DataHandle ) ) THEN
        IF ( okay_to_write( DataHandle ) ) THEN
           FileStatus = WRF_FILE_OPENED_FOR_WRITE
        ELSE
           FileStatus = WRF_FILE_OPENED_NOT_COMMITTED
        ENDIF
      ELSE
        FileStatus = WRF_FILE_NOT_OPENED
      ENDIF
    ENDIF
    WRITE( msg,* ) 'ERROR ext_esmf_inquire_opened:  file handle ',DataHandle,' is invalid'
    CALL wrf_error_fatal ( TRIM(msg) )
  ENDIF

  WRITE( msg,* ) 'DEBUG ext_esmf_inquire_opened:  end, FileStatus = ', FileStatus
  CALL wrf_debug ( 5 , TRIM(msg) )

  Status = 0
  
  RETURN
END SUBROUTINE ext_esmf_inquire_opened

!--- inquire_filename
SUBROUTINE ext_esmf_inquire_filename ( DataHandle, FileName , FileStatus, Status )
  USE module_ext_esmf
  IMPLICIT NONE
  INTEGER ,       INTENT(IN)  :: DataHandle
  CHARACTER*(*) :: FileName
  INTEGER ,       INTENT(OUT) :: FileStatus
  INTEGER ,       INTENT(OUT) :: Status
  CHARACTER *80   SysDepInfo
  Status = 0

  WRITE( msg,* ) 'DEBUG ext_esmf_inquire_filename:  begin, DataHandle = ', DataHandle
  CALL wrf_debug ( 5 , TRIM(msg) )
  WRITE( msg,* ) 'DEBUG ext_esmf_inquire_filename:  int_valid_handle(',DataHandle,') = ', &
                 int_valid_handle( DataHandle )
  CALL wrf_debug ( 5 , TRIM(msg) )
  WRITE( msg,* ) 'DEBUG ext_esmf_inquire_filename:  int_handle_in_use(',DataHandle,') = ', &
                 int_handle_in_use( DataHandle )
  CALL wrf_debug ( 5 , TRIM(msg) )
  WRITE( msg,* ) 'DEBUG ext_esmf_inquire_filename:  opened_for_read(',DataHandle,') = ', &
                 opened_for_read( DataHandle )
  CALL wrf_debug ( 5 , TRIM(msg) )
  WRITE( msg,* ) 'DEBUG ext_esmf_inquire_filename:  okay_to_read(',DataHandle,') = ', &
                 okay_to_read( DataHandle )
  CALL wrf_debug ( 5 , TRIM(msg) )
  WRITE( msg,* ) 'DEBUG ext_esmf_inquire_filename:  opened_for_write(',DataHandle,') = ', &
                 opened_for_write( DataHandle )
  CALL wrf_debug ( 5 , TRIM(msg) )
  WRITE( msg,* ) 'DEBUG ext_esmf_inquire_filename:  okay_to_write(',DataHandle,') = ', &
                 okay_to_write( DataHandle )
  CALL wrf_debug ( 5 , TRIM(msg) )

!TODO:  need to cache file name and return via FileName argument

  FileStatus = WRF_FILE_NOT_OPENED
  IF ( int_valid_handle( DataHandle ) ) THEN
    IF ( int_handle_in_use( DataHandle ) ) THEN
      IF ( opened_for_read ( DataHandle ) ) THEN
        IF ( okay_to_read( DataHandle ) ) THEN
           FileStatus = WRF_FILE_OPENED_FOR_READ
        ELSE
           FileStatus = WRF_FILE_OPENED_NOT_COMMITTED
        ENDIF
      ELSE IF ( opened_for_write( DataHandle ) ) THEN
        IF ( okay_to_write( DataHandle ) ) THEN
           FileStatus = WRF_FILE_OPENED_FOR_WRITE
        ELSE
           FileStatus = WRF_FILE_OPENED_NOT_COMMITTED
        ENDIF
      ELSE
        FileStatus = WRF_FILE_NOT_OPENED
      ENDIF
    ENDIF
    WRITE( msg,* ) 'ERROR ext_esmf_inquire_filename:  file handle ',DataHandle,' is invalid'
    CALL wrf_error_fatal ( TRIM(msg) )
  ENDIF

  WRITE( msg,* ) 'DEBUG ext_esmf_inquire_filename:  end, FileStatus = ', FileStatus
  CALL wrf_debug ( 5 , TRIM(msg) )

  Status = 0
  RETURN
END SUBROUTINE ext_esmf_inquire_filename

!--- sync
SUBROUTINE ext_esmf_iosync ( DataHandle, Status )
  USE module_ext_esmf
  IMPLICIT NONE
  INTEGER ,       INTENT(IN)  :: DataHandle
  INTEGER ,       INTENT(OUT) :: Status
  Status = 0
  RETURN
END SUBROUTINE ext_esmf_iosync

!--- close
SUBROUTINE ext_esmf_ioclose ( DataHandle, Status )
  USE module_ext_esmf
  IMPLICIT NONE
  INTEGER DataHandle, Status
  ! locals
  TYPE state_ptr
    TYPE(ESMF_State), POINTER :: stateptr
  END TYPE state_ptr
  TYPE(state_ptr) :: states(2)
  TYPE(ESMF_State), POINTER :: state
  INTEGER :: numItems, numFields, i, istate
  TYPE(ESMF_StateItem_Flag), ALLOCATABLE :: itemTypes(:)
  TYPE(ESMF_Field) :: tmpField
  REAL, POINTER :: tmp_ptr(:,:)
  CHARACTER (len=ESMF_MAXSTR), ALLOCATABLE :: itemNames(:)
  CHARACTER (len=ESMF_MAXSTR) :: str
  INTEGER :: rc

! TODO:  The code below hangs with this error message:  
! TODO:  "ext_esmf_ioclose:  ESMF_FieldGetDataPointer( LANDMASK) failed"
! TODO:  Fix this so ESMF objects actually get destroyed to avoid memory 
! TODO:  leaks.  
  CALL wrf_debug( 5, 'ext_esmf_ioclose:  WARNING:  not destroying ESMF objects' )
#if 0
  !TODO:  Need to upgrade this to use nested ESMF_States if we want support 
  !TODO:  more than one auxin and one auxhist stream for ESMF.  
  IF ( int_valid_handle (DataHandle) ) THEN
    IF ( int_handle_in_use( DataHandle ) ) THEN
      ! Iterate through importState *and* exportState, find each ESMF_Field, 
      ! extract its data pointer and deallocate it, then destroy the 
      ! ESMF_Field.  
      CALL ESMF_ImportStateGetCurrent(states(1)%stateptr, rc)
      IF ( rc /= ESMF_SUCCESS ) THEN
        CALL wrf_error_fatal( 'ext_esmf_ioclose:  ESMF_ImportStateGetCurrent failed' )
      ENDIF
      CALL ESMF_ExportStateGetCurrent(states(2)%stateptr, rc)
      IF ( rc /= ESMF_SUCCESS ) THEN
        CALL wrf_error_fatal( 'ext_esmf_ioclose:  ESMF_ExportStateGetCurrent failed' )
      ENDIF
      DO istate=1, 2
        state => states(istate)%stateptr   ! all this to avoid assignment (@#$%)
        ! Since there are no convenient iterators for ESMF_State (@#$%),
        ! write a lot of code...
        ! Figure out how many items are in the ESMF_State
        CALL ESMF_StateGet(state, itemCount=numItems, rc=rc)
        IF ( rc /= ESMF_SUCCESS) THEN
          CALL wrf_error_fatal ( 'ext_esmf_ioclose:  ESMF_StateGet(numItems) failed' )
        ENDIF
        ! allocate an array to hold the types of all items
        ALLOCATE( itemTypes(numItems) )
        ! allocate an array to hold the names of all items
        ALLOCATE( itemNames(numItems) )
        ! get the item types and names
!5.2.0r        CALL ESMF_StateGet(state, stateitemtypeList=itemTypes, &
        CALL ESMF_StateGet(state, itemtypeList=itemTypes, &
                           itemNameList=itemNames, rc=rc)
        IF ( rc /= ESMF_SUCCESS) THEN
          WRITE(str,*) 'ext_esmf_ioclose:  ESMF_StateGet itemTypes failed with rc = ', rc
          CALL wrf_error_fatal ( str )
        ENDIF
        ! count how many items are ESMF_Fields
        numFields = 0
        DO i=1,numItems
          IF ( itemTypes(i) == ESMF_STATEITEM_FIELD ) THEN
            numFields = numFields + 1
          ENDIF
        ENDDO
        IF ( numFields > 0) THEN
          ! finally, extract nested ESMF_Fields by name, if there are any
          ! (should be able to do this by index at least -- @#%$)
          DO i=1,numItems
            IF ( itemTypes(i) == ESMF_STATEITEM_FIELD ) THEN
              CALL ESMF_StateGetField( state, TRIM(itemNames(i)), &
                                       tmpField, rc=rc )
              IF ( rc /= ESMF_SUCCESS) THEN
                WRITE(str,*) 'ext_esmf_ioclose:  ESMF_StateGetField(',TRIM(itemNames(i)),') failed'
                CALL wrf_error_fatal ( str )
              ENDIF
              ! destroy pointer in field
              CALL ESMF_FieldGetDataPointer( tmpField, tmp_ptr, rc=rc )
              IF (rc /= ESMF_SUCCESS) THEN
                WRITE( str , * )                                   &
                  'ext_esmf_ioclose:  ESMF_FieldGetDataPointer( ', &
                  TRIM(itemNames(i)),') failed'
                CALL wrf_error_fatal ( TRIM(str) )
              ENDIF
              DEALLOCATE( tmp_ptr )
              ! destroy field
              CALL ESMF_FieldDestroy( tmpField, rc=rc )
              IF (rc /= ESMF_SUCCESS) THEN
                WRITE( str , * )                            &
                  'ext_esmf_ioclose:  ESMF_FieldDestroy( ', &
                  TRIM(itemNames(i)),') failed'
                CALL wrf_error_fatal ( TRIM(str) )
              ENDIF
            ENDIF
          ENDDO
        ENDIF
        ! deallocate locals
        DEALLOCATE( itemTypes )
        DEALLOCATE( itemNames )
      ENDDO
      ! destroy ESMF_Grid associated with DataHandle
      CALL ioesmf_destroy_grid( DataHandle )
    ENDIF
  ENDIF
#endif
  Status = 0
  RETURN
END SUBROUTINE ext_esmf_ioclose

!--- ioexit
SUBROUTINE ext_esmf_ioexit( Status )
  USE module_ext_esmf
  IMPLICIT NONE
  INTEGER ,       INTENT(OUT) :: Status
  INTEGER :: i
  Status = 0
! TODO:  The code below causes ext_ncd_ioclose() to fail in the 
! TODO:  SST component for reasons as-yet unknown.  
! TODO:  Fix this so ESMF objects actually get destroyed to avoid memory 
! TODO:  leaks.  
  CALL wrf_debug( 5, 'ext_esmf_ioexit:  WARNING:  not destroying ESMF objects' )
#if 0
  DO i = 1, int_num_handles
    ! close any remaining open DataHandles
    CALL ext_esmf_ioclose ( i, Status )
    ! destroy ESMF_Grid for this DataHandle
    CALL ioesmf_destroy_grid( i )
  ENDDO
  CALL wrf_debug ( 5 , &
    'ext_esmf_ioexit:  DEBUG:  done cleaning up ESMF objects' )
#endif
  RETURN  
END SUBROUTINE ext_esmf_ioexit

!--- get_next_time
SUBROUTINE ext_esmf_get_next_time ( DataHandle, DateStr, Status )
  USE module_ext_esmf
  IMPLICIT NONE
  INTEGER ,       INTENT(IN)  :: DataHandle
  CHARACTER*(*) :: DateStr
  INTEGER ,       INTENT(OUT) :: Status
  IF ( .NOT. int_valid_handle( DataHandle ) ) THEN
    CALL wrf_error_fatal("io_esmf.F90: ext_esmf_get_next_time: invalid data handle" )
  ENDIF
  IF ( .NOT. int_handle_in_use( DataHandle ) ) THEN
    CALL wrf_error_fatal("io_esmf.F90: ext_esmf_get_next_time: DataHandle not opened" )
  ENDIF
  CALL wrf_debug(1, "ext_esmf_get_next_time() not supported yet")
  Status = WRF_WARN_NOTSUPPORTED
  RETURN
END SUBROUTINE ext_esmf_get_next_time

!--- set_time
SUBROUTINE ext_esmf_set_time ( DataHandle, DateStr, Status )
  USE module_ext_esmf
  IMPLICIT NONE
  INTEGER ,       INTENT(IN)  :: DataHandle
  CHARACTER*(*) :: DateStr
  INTEGER ,       INTENT(OUT) :: Status
  CALL wrf_debug(1, "ext_esmf_set_time() not supported yet")
  Status = WRF_WARN_NOTSUPPORTED
  RETURN
END SUBROUTINE ext_esmf_set_time

!--- get_var_info
SUBROUTINE ext_esmf_get_var_info ( DataHandle , VarName , NDim , MemoryOrder , Stagger , &
                                   DomainStart , DomainEnd , WrfType, Status )
  USE module_ext_esmf
  IMPLICIT NONE
  integer               ,intent(in)     :: DataHandle
  character*(*)         ,intent(in)     :: VarName
  integer               ,intent(out)    :: NDim
  character*(*)         ,intent(out)    :: MemoryOrder
  character*(*)         ,intent(out)    :: Stagger
  integer ,dimension(*) ,intent(out)    :: DomainStart, DomainEnd
  integer               ,intent(out)    :: WrfType
  integer               ,intent(out)    :: Status

  IF ( .NOT. int_valid_handle( DataHandle ) ) THEN
    CALL wrf_error_fatal("io_esmf.F90: ext_esmf_get_var_info: invalid data handle" )
  ENDIF
  IF ( .NOT. int_handle_in_use( DataHandle ) ) THEN
    CALL wrf_error_fatal("io_esmf.F90: ext_esmf_get_var_info: DataHandle not opened" )
  ENDIF
  CALL wrf_debug(1, "ext_esmf_get_var_info() not supported yet")
  Status = WRF_WARN_NOTSUPPORTED
  RETURN
END SUBROUTINE ext_esmf_get_var_info

!--- get_next_var
SUBROUTINE ext_esmf_get_next_var ( DataHandle, VarName, Status )
  USE module_ext_esmf
  IMPLICIT NONE
  INTEGER ,       INTENT(IN)  :: DataHandle
  CHARACTER*(*) :: VarName
  INTEGER ,       INTENT(OUT) :: Status

  IF ( .NOT. int_valid_handle( DataHandle ) ) THEN
    CALL wrf_error_fatal("external/io_esmf/io_esmf.F90: ext_esmf_get_next_var: invalid data handle" )
  ENDIF
  IF ( .NOT. int_handle_in_use( DataHandle ) ) THEN
    CALL wrf_error_fatal("external/io_esmf/io_esmf.F90: ext_esmf_get_next_var: DataHandle not opened" )
  ENDIF
  CALL wrf_debug(1, "ext_esmf_get_next_var() not supported yet")
  Status = WRF_WARN_NOTSUPPORTED
  RETURN
END SUBROUTINE ext_esmf_get_next_var

!--- get_dom_ti_real
SUBROUTINE ext_esmf_get_dom_ti_real ( DataHandle,Element,   Data, Count, Outcount, Status )
  USE module_ext_esmf
  IMPLICIT NONE
  INTEGER ,       INTENT(IN)  :: DataHandle
  CHARACTER*(*) :: Element
  real ,            INTENT(IN) :: Data(*)
  INTEGER ,       INTENT(IN)  :: Count
  INTEGER ,       INTENT(OUT) :: Outcount
  INTEGER ,       INTENT(OUT) :: Status
  CALL wrf_debug(1, "ext_esmf_get_dom_ti_real() not supported yet")
  Status = WRF_WARN_NOTSUPPORTED
  RETURN
END SUBROUTINE ext_esmf_get_dom_ti_real 

!--- put_dom_ti_real
SUBROUTINE ext_esmf_put_dom_ti_real ( DataHandle,Element,   Data, Count,  Status )
  USE module_ext_esmf
  IMPLICIT NONE
  INTEGER ,       INTENT(IN)  :: DataHandle
  CHARACTER*(*) :: Element
  real ,            INTENT(IN) :: Data(*)
  INTEGER ,       INTENT(IN)  :: Count
  INTEGER ,       INTENT(OUT) :: Status
  CALL wrf_debug(1, "ext_esmf_put_dom_ti_real() not supported yet")
  Status = WRF_WARN_NOTSUPPORTED
  RETURN
END SUBROUTINE ext_esmf_put_dom_ti_real 

!--- get_dom_ti_double
SUBROUTINE ext_esmf_get_dom_ti_double ( DataHandle,Element,   Data, Count, Outcount, Status )
  USE module_ext_esmf
  IMPLICIT NONE
  INTEGER ,       INTENT(IN)  :: DataHandle
  CHARACTER*(*) :: Element
  real*8 ,            INTENT(OUT) :: Data(*)
  INTEGER ,       INTENT(IN)  :: Count
  INTEGER ,       INTENT(OUT)  :: OutCount
  INTEGER ,       INTENT(OUT) :: Status
  CALL wrf_debug(1,'ext_esmf_get_dom_ti_double not supported yet')
  Status = WRF_WARN_NOTSUPPORTED
  RETURN
END SUBROUTINE ext_esmf_get_dom_ti_double 

!--- put_dom_ti_double
SUBROUTINE ext_esmf_put_dom_ti_double ( DataHandle,Element,   Data, Count,  Status )
  USE module_ext_esmf
  IMPLICIT NONE
  INTEGER ,       INTENT(IN)  :: DataHandle
  CHARACTER*(*) :: Element
  real*8 ,            INTENT(IN) :: Data(*)
  INTEGER ,       INTENT(IN)  :: Count
  INTEGER ,       INTENT(OUT) :: Status
  CALL wrf_debug(1,'ext_esmf_put_dom_ti_double not supported yet')
  Status = WRF_WARN_NOTSUPPORTED
  RETURN
END SUBROUTINE ext_esmf_put_dom_ti_double 

!--- get_dom_ti_integer
SUBROUTINE ext_esmf_get_dom_ti_integer ( DataHandle,Element,   Data, Count, Outcount, Status )
  USE module_ext_esmf
  IMPLICIT NONE
  INTEGER ,       INTENT(IN)  :: DataHandle
  CHARACTER*(*) :: Element
  integer ,            INTENT(OUT) :: Data(*)
  INTEGER ,       INTENT(IN)  :: Count
  INTEGER ,       INTENT(OUT)  :: OutCount
  INTEGER ,       INTENT(OUT) :: Status

  Status = 0
  IF      ( Element == 'WEST-EAST_GRID_DIMENSION' ) THEN
    Data(1) = grid( DataHandle )%ide_save
    Outcount = 1
  ELSE IF ( Element == 'SOUTH-NORTH_GRID_DIMENSION' ) THEN
    Data(1) = grid( DataHandle )%jde_save
    Outcount = 1
  ELSE IF ( Element == 'BOTTOM-TOP_GRID_DIMENSION' ) THEN
    Data(1) = grid( DataHandle )%kde_save
    Outcount = 1
  ELSE
    CALL wrf_debug(1,'ext_esmf_get_dom_ti_integer not fully supported yet')
    Status = WRF_WARN_NOTSUPPORTED
  ENDIF

  RETURN
END SUBROUTINE ext_esmf_get_dom_ti_integer 

!--- put_dom_ti_integer
SUBROUTINE ext_esmf_put_dom_ti_integer ( DataHandle,Element,   Data, Count,  Status )
  USE module_ext_esmf
  IMPLICIT NONE
  INTEGER ,       INTENT(IN)  :: DataHandle
  CHARACTER*(*) :: Element
  INTEGER ,       INTENT(IN) :: Data(*)
  INTEGER ,       INTENT(IN)  :: Count
  INTEGER ,       INTENT(OUT) :: Status
  CALL wrf_debug(1,'ext_esmf_put_dom_ti_integer not supported yet')
  Status = WRF_WARN_NOTSUPPORTED
  RETURN
END SUBROUTINE ext_esmf_put_dom_ti_integer 

!--- get_dom_ti_logical
SUBROUTINE ext_esmf_get_dom_ti_logical ( DataHandle,Element,   Data, Count, Outcount, Status )
  USE module_ext_esmf
  IMPLICIT NONE
  INTEGER ,       INTENT(IN)  :: DataHandle
  CHARACTER*(*) :: Element
  logical ,            INTENT(OUT) :: Data(*)
  INTEGER ,       INTENT(IN)  :: Count
  INTEGER ,       INTENT(OUT)  :: OutCount
  INTEGER ,       INTENT(OUT) :: Status
  CALL wrf_debug(1,'ext_esmf_get_dom_ti_logical not supported yet')
  Status = WRF_WARN_NOTSUPPORTED
  RETURN
END SUBROUTINE ext_esmf_get_dom_ti_logical 

!--- put_dom_ti_logical
SUBROUTINE ext_esmf_put_dom_ti_logical ( DataHandle,Element,   Data, Count,  Status )
  USE module_ext_esmf
  IMPLICIT NONE
  INTEGER ,       INTENT(IN)  :: DataHandle
  CHARACTER*(*) :: Element
  logical ,            INTENT(IN) :: Data(*)
  INTEGER ,       INTENT(IN)  :: Count
  INTEGER ,       INTENT(OUT) :: Status
  CALL wrf_debug(1,'ext_esmf_put_dom_ti_logical not supported yet')
  Status = WRF_WARN_NOTSUPPORTED
  RETURN
END SUBROUTINE ext_esmf_put_dom_ti_logical 

!--- get_dom_ti_char
SUBROUTINE ext_esmf_get_dom_ti_char ( DataHandle,Element,   Data,  Status )
  USE module_ext_esmf
  IMPLICIT NONE
  INTEGER ,       INTENT(IN)  :: DataHandle
  CHARACTER*(*) :: Element
  CHARACTER*(*) :: Data
  INTEGER ,       INTENT(OUT) :: Status
  CALL wrf_debug(1,'ext_esmf_get_dom_ti_char not supported yet')
  Status = WRF_WARN_NOTSUPPORTED
  RETURN
END SUBROUTINE ext_esmf_get_dom_ti_char 

!--- put_dom_ti_char
SUBROUTINE ext_esmf_put_dom_ti_char ( DataHandle, Element,  Data,  Status )
  USE module_ext_esmf
  IMPLICIT NONE
  INTEGER ,       INTENT(IN)  :: DataHandle
  CHARACTER*(*) :: Element
  CHARACTER*(*) :: Data
  INTEGER ,       INTENT(OUT) :: Status
  CALL wrf_debug(1,'ext_esmf_put_dom_ti_char not supported yet')
  Status = WRF_WARN_NOTSUPPORTED
  RETURN
END SUBROUTINE ext_esmf_put_dom_ti_char 

!--- get_dom_td_real
SUBROUTINE ext_esmf_get_dom_td_real ( DataHandle,Element, DateStr,  Data, Count, Outcount, Status )
  USE module_ext_esmf
  IMPLICIT NONE
  INTEGER ,       INTENT(IN)  :: DataHandle
  CHARACTER*(*) :: Element
  CHARACTER*(*) :: DateStr
  real ,            INTENT(OUT) :: Data(*)
  INTEGER ,       INTENT(IN)  :: Count
  INTEGER ,       INTENT(OUT)  :: OutCount
  INTEGER ,       INTENT(OUT) :: Status
  CALL wrf_debug(1,'ext_esmf_get_dom_td_real not supported yet')
  Status = WRF_WARN_NOTSUPPORTED
  RETURN
END SUBROUTINE ext_esmf_get_dom_td_real 

!--- put_dom_td_real
SUBROUTINE ext_esmf_put_dom_td_real ( DataHandle,Element, DateStr,  Data, Count,  Status )
  USE module_ext_esmf
  IMPLICIT NONE
  INTEGER ,       INTENT(IN)  :: DataHandle
  CHARACTER*(*) :: Element
  CHARACTER*(*) :: DateStr
  real ,            INTENT(IN) :: Data(*)
  INTEGER ,       INTENT(IN)  :: Count
  INTEGER ,       INTENT(OUT) :: Status
  CALL wrf_debug(1,'ext_esmf_put_dom_td_real not supported yet')
  Status = WRF_WARN_NOTSUPPORTED
  RETURN
END SUBROUTINE ext_esmf_put_dom_td_real 

!--- get_dom_td_double
SUBROUTINE ext_esmf_get_dom_td_double ( DataHandle,Element, DateStr,  Data, Count, Outcount, Status )
  USE module_ext_esmf
  IMPLICIT NONE
  INTEGER ,       INTENT(IN)  :: DataHandle
  CHARACTER*(*) :: Element
  CHARACTER*(*) :: DateStr
  real*8 ,            INTENT(OUT) :: Data(*)
  INTEGER ,       INTENT(IN)  :: Count
  INTEGER ,       INTENT(OUT)  :: OutCount
  INTEGER ,       INTENT(OUT) :: Status
  CALL wrf_debug(1,'ext_esmf_get_dom_td_double not supported yet')
  Status = WRF_WARN_NOTSUPPORTED
  RETURN
END SUBROUTINE ext_esmf_get_dom_td_double 

!--- put_dom_td_double
SUBROUTINE ext_esmf_put_dom_td_double ( DataHandle,Element, DateStr,  Data, Count,  Status )
  USE module_ext_esmf
  IMPLICIT NONE
  INTEGER ,       INTENT(IN)  :: DataHandle
  CHARACTER*(*) :: Element
  CHARACTER*(*) :: DateStr
  real*8 ,            INTENT(IN) :: Data(*)
  INTEGER ,       INTENT(IN)  :: Count
  INTEGER ,       INTENT(OUT) :: Status
  CALL wrf_debug(1,'ext_esmf_put_dom_td_double not supported yet')
  Status = WRF_WARN_NOTSUPPORTED
  RETURN
END SUBROUTINE ext_esmf_put_dom_td_double 

!--- get_dom_td_integer
SUBROUTINE ext_esmf_get_dom_td_integer ( DataHandle,Element, DateStr,  Data, Count, Outcount, Status )
  USE module_ext_esmf
  IMPLICIT NONE
  INTEGER ,       INTENT(IN)  :: DataHandle
  CHARACTER*(*) :: Element
  CHARACTER*(*) :: DateStr
  integer ,            INTENT(OUT) :: Data(*)
  INTEGER ,       INTENT(IN)  :: Count
  INTEGER ,       INTENT(OUT)  :: OutCount
  INTEGER ,       INTENT(OUT) :: Status
  CALL wrf_debug(1,'ext_esmf_get_dom_td_integer not supported yet')
  Status = WRF_WARN_NOTSUPPORTED
  RETURN
END SUBROUTINE ext_esmf_get_dom_td_integer 

!--- put_dom_td_integer
SUBROUTINE ext_esmf_put_dom_td_integer ( DataHandle,Element, DateStr,  Data, Count,  Status )
  USE module_ext_esmf
  IMPLICIT NONE
  INTEGER ,       INTENT(IN)  :: DataHandle
  CHARACTER*(*) :: Element
  CHARACTER*(*) :: DateStr
  integer ,            INTENT(IN) :: Data(*)
  INTEGER ,       INTENT(IN)  :: Count
  INTEGER ,       INTENT(OUT) :: Status
  CALL wrf_debug(1,'ext_esmf_put_dom_td_integer not supported yet')
  Status = WRF_WARN_NOTSUPPORTED
  RETURN
END SUBROUTINE ext_esmf_put_dom_td_integer 

!--- get_dom_td_logical
SUBROUTINE ext_esmf_get_dom_td_logical ( DataHandle,Element, DateStr,  Data, Count, Outcount, Status )
  USE module_ext_esmf
  IMPLICIT NONE
  INTEGER ,       INTENT(IN)  :: DataHandle
  CHARACTER*(*) :: Element
  CHARACTER*(*) :: DateStr
  logical ,            INTENT(OUT) :: Data(*)
  INTEGER ,       INTENT(IN)  :: Count
  INTEGER ,       INTENT(OUT)  :: OutCount
  INTEGER ,       INTENT(OUT) :: Status
  CALL wrf_debug(1,'ext_esmf_get_dom_td_logical not supported yet')
  Status = WRF_WARN_NOTSUPPORTED
  RETURN
END SUBROUTINE ext_esmf_get_dom_td_logical 

!--- put_dom_td_logical
SUBROUTINE ext_esmf_put_dom_td_logical ( DataHandle,Element, DateStr,  Data, Count,  Status )
  USE module_ext_esmf
  IMPLICIT NONE
  INTEGER ,       INTENT(IN)  :: DataHandle
  CHARACTER*(*) :: Element
  CHARACTER*(*) :: DateStr
  logical ,            INTENT(IN) :: Data(*)
  INTEGER ,       INTENT(IN)  :: Count
  INTEGER ,       INTENT(OUT) :: Status
  CALL wrf_debug(1,'ext_esmf_put_dom_td_logical not supported yet')
  Status = WRF_WARN_NOTSUPPORTED
  RETURN
END SUBROUTINE ext_esmf_put_dom_td_logical 

!--- get_dom_td_char
SUBROUTINE ext_esmf_get_dom_td_char ( DataHandle,Element, DateStr,  Data,  Status )
  USE module_ext_esmf
  IMPLICIT NONE
  INTEGER ,       INTENT(IN)  :: DataHandle
  CHARACTER*(*) :: Element
  CHARACTER*(*) :: DateStr
  CHARACTER*(*) :: Data
  INTEGER ,       INTENT(OUT) :: Status
  CALL wrf_debug(1,'ext_esmf_get_dom_td_char not supported yet')
  Status = WRF_WARN_NOTSUPPORTED
  RETURN
END SUBROUTINE ext_esmf_get_dom_td_char 

!--- put_dom_td_char
SUBROUTINE ext_esmf_put_dom_td_char ( DataHandle,Element, DateStr,  Data,  Status )
  USE module_ext_esmf
  IMPLICIT NONE
  INTEGER ,       INTENT(IN)  :: DataHandle
  CHARACTER*(*) :: Element
  CHARACTER*(*) :: DateStr
  CHARACTER*(*) :: Data
  INTEGER ,       INTENT(OUT) :: Status
  CALL wrf_debug(1,'ext_esmf_put_dom_td_char not supported yet')
  Status = WRF_WARN_NOTSUPPORTED
  RETURN
END SUBROUTINE ext_esmf_put_dom_td_char 

!--- get_var_ti_real
SUBROUTINE ext_esmf_get_var_ti_real ( DataHandle,Element,  Varname, Data, Count, Outcount, Status )
  USE module_ext_esmf
  IMPLICIT NONE
  INTEGER ,       INTENT(IN)  :: DataHandle
  CHARACTER*(*) :: Element
  CHARACTER*(*) :: VarName 
  real ,            INTENT(OUT) :: Data(*)
  INTEGER ,       INTENT(IN)  :: Count
  INTEGER ,       INTENT(OUT)  :: OutCount
  INTEGER ,       INTENT(OUT) :: Status
  CALL wrf_debug(1,'ext_esmf_get_var_ti_real not supported yet')
  Status = WRF_WARN_NOTSUPPORTED
  RETURN
END SUBROUTINE ext_esmf_get_var_ti_real 

!--- put_var_ti_real
SUBROUTINE ext_esmf_put_var_ti_real ( DataHandle,Element,  Varname, Data, Count,  Status )
  USE module_ext_esmf
  IMPLICIT NONE
  INTEGER ,       INTENT(IN)  :: DataHandle
  CHARACTER*(*) :: Element
  CHARACTER*(*) :: VarName 
  real ,            INTENT(IN) :: Data(*)
  INTEGER ,       INTENT(IN)  :: Count
  INTEGER ,       INTENT(OUT) :: Status
  CALL wrf_debug(1,'ext_esmf_put_var_ti_real not supported yet')
  Status = WRF_WARN_NOTSUPPORTED
  RETURN
END SUBROUTINE ext_esmf_put_var_ti_real 

!--- get_var_ti_double
SUBROUTINE ext_esmf_get_var_ti_double ( DataHandle,Element,  Varname, Data, Count, Outcount, Status )
  USE module_ext_esmf
  IMPLICIT NONE
  INTEGER ,       INTENT(IN)  :: DataHandle
  CHARACTER*(*) :: Element
  CHARACTER*(*) :: VarName 
  real*8 ,            INTENT(OUT) :: Data(*)
  INTEGER ,       INTENT(IN)  :: Count
  INTEGER ,       INTENT(OUT)  :: OutCount
  INTEGER ,       INTENT(OUT) :: Status
  CALL wrf_debug(1,'ext_esmf_get_var_ti_double not supported yet')
  Status = WRF_WARN_NOTSUPPORTED
  RETURN
END SUBROUTINE ext_esmf_get_var_ti_double 

!--- put_var_ti_double
SUBROUTINE ext_esmf_put_var_ti_double ( DataHandle,Element,  Varname, Data, Count,  Status )
  USE module_ext_esmf
  IMPLICIT NONE
  INTEGER ,       INTENT(IN)  :: DataHandle
  CHARACTER*(*) :: Element
  CHARACTER*(*) :: VarName 
  real*8 ,            INTENT(IN) :: Data(*)
  INTEGER ,       INTENT(IN)  :: Count
  INTEGER ,       INTENT(OUT) :: Status
  CALL wrf_debug(1,'ext_esmf_put_var_ti_double not supported yet')
  Status = WRF_WARN_NOTSUPPORTED
  RETURN
END SUBROUTINE ext_esmf_put_var_ti_double 

!--- get_var_ti_integer
SUBROUTINE ext_esmf_get_var_ti_integer ( DataHandle,Element,  Varname, Data, Count, Outcount, Status )
  USE module_ext_esmf
  IMPLICIT NONE
  INTEGER ,       INTENT(IN)  :: DataHandle
  CHARACTER*(*) :: Element
  CHARACTER*(*) :: VarName 
  integer ,            INTENT(OUT) :: Data(*)
  INTEGER ,       INTENT(IN)  :: Count
  INTEGER ,       INTENT(OUT)  :: OutCount
  INTEGER ,       INTENT(OUT) :: Status
  CALL wrf_debug(1,'ext_esmf_get_var_ti_integer not supported yet')
  Status = WRF_WARN_NOTSUPPORTED
  RETURN
END SUBROUTINE ext_esmf_get_var_ti_integer 

!--- put_var_ti_integer
SUBROUTINE ext_esmf_put_var_ti_integer ( DataHandle,Element,  Varname, Data, Count,  Status )
  USE module_ext_esmf
  IMPLICIT NONE
  INTEGER ,       INTENT(IN)  :: DataHandle
  CHARACTER*(*) :: Element
  CHARACTER*(*) :: VarName 
  integer ,            INTENT(IN) :: Data(*)
  INTEGER ,       INTENT(IN)  :: Count
  INTEGER ,       INTENT(OUT) :: Status
  CALL wrf_debug(1,'ext_esmf_put_var_ti_integer not supported yet')
  Status = WRF_WARN_NOTSUPPORTED
  RETURN
END SUBROUTINE ext_esmf_put_var_ti_integer 

!--- get_var_ti_logical
SUBROUTINE ext_esmf_get_var_ti_logical ( DataHandle,Element,  Varname, Data, Count, Outcount, Status )
  USE module_ext_esmf
  IMPLICIT NONE
  INTEGER ,       INTENT(IN)  :: DataHandle
  CHARACTER*(*) :: Element
  CHARACTER*(*) :: VarName 
  logical ,            INTENT(OUT) :: Data(*)
  INTEGER ,       INTENT(IN)  :: Count
  INTEGER ,       INTENT(OUT)  :: OutCount
  INTEGER ,       INTENT(OUT) :: Status
  CALL wrf_debug(1,'ext_esmf_get_var_ti_logical not supported yet')
  Status = WRF_WARN_NOTSUPPORTED
  RETURN
END SUBROUTINE ext_esmf_get_var_ti_logical 

!--- put_var_ti_logical
SUBROUTINE ext_esmf_put_var_ti_logical ( DataHandle,Element,  Varname, Data, Count,  Status )
  USE module_ext_esmf
  IMPLICIT NONE
  INTEGER ,       INTENT(IN)  :: DataHandle
  CHARACTER*(*) :: Element
  CHARACTER*(*) :: VarName 
  logical ,            INTENT(IN) :: Data(*)
  INTEGER ,       INTENT(IN)  :: Count
  INTEGER ,       INTENT(OUT) :: Status
  CALL wrf_debug(1,'ext_esmf_put_var_ti_logical not supported yet')
  Status = WRF_WARN_NOTSUPPORTED
  RETURN
END SUBROUTINE ext_esmf_put_var_ti_logical 

!--- get_var_ti_char
SUBROUTINE ext_esmf_get_var_ti_char ( DataHandle,Element,  Varname, Data,  Status )
  USE module_ext_esmf
  IMPLICIT NONE
  INTEGER ,       INTENT(IN)  :: DataHandle
  CHARACTER*(*) :: Element
  CHARACTER*(*) :: VarName 
  CHARACTER*(*) :: Data
  INTEGER ,       INTENT(OUT) :: Status
  INTEGER locDataHandle, code
  CHARACTER*132 locElement, locVarName
  CALL wrf_debug(1,'ext_esmf_get_var_ti_char not supported yet')
  Status = WRF_WARN_NOTSUPPORTED
  RETURN
END SUBROUTINE ext_esmf_get_var_ti_char 

!--- put_var_ti_char
SUBROUTINE ext_esmf_put_var_ti_char ( DataHandle,Element,  Varname, Data,  Status )
  USE module_ext_esmf
  IMPLICIT NONE
  INTEGER ,       INTENT(IN)  :: DataHandle
  CHARACTER*(*) :: Element
  CHARACTER*(*) :: VarName 
  CHARACTER*(*) :: Data
  INTEGER ,       INTENT(OUT) :: Status
  REAL dummy
  INTEGER                 :: Count
  CALL wrf_debug(1,'ext_esmf_put_var_ti_char not supported yet')
  Status = WRF_WARN_NOTSUPPORTED
  RETURN
END SUBROUTINE ext_esmf_put_var_ti_char 

!--- get_var_td_real
SUBROUTINE ext_esmf_get_var_td_real ( DataHandle,Element,  DateStr,Varname, Data, Count, Outcount, Status )
  USE module_ext_esmf
  IMPLICIT NONE
  INTEGER ,       INTENT(IN)  :: DataHandle
  CHARACTER*(*) :: Element
  CHARACTER*(*) :: DateStr
  CHARACTER*(*) :: VarName 
  real ,            INTENT(OUT) :: Data(*)
  INTEGER ,       INTENT(IN)  :: Count
  INTEGER ,       INTENT(OUT)  :: OutCount
  INTEGER ,       INTENT(OUT) :: Status
  CALL wrf_debug(1,'ext_esmf_get_var_td_real not supported yet')
  Status = WRF_WARN_NOTSUPPORTED
  RETURN
END SUBROUTINE ext_esmf_get_var_td_real 

!--- put_var_td_real
SUBROUTINE ext_esmf_put_var_td_real ( DataHandle,Element,  DateStr,Varname, Data, Count,  Status )
  USE module_ext_esmf
  IMPLICIT NONE
  INTEGER ,       INTENT(IN)  :: DataHandle
  CHARACTER*(*) :: Element
  CHARACTER*(*) :: DateStr
  CHARACTER*(*) :: VarName 
  real ,            INTENT(IN) :: Data(*)
  INTEGER ,       INTENT(IN)  :: Count
  INTEGER ,       INTENT(OUT) :: Status
  CALL wrf_debug(1,'ext_esmf_put_var_td_real not supported yet')
  Status = WRF_WARN_NOTSUPPORTED
  RETURN
END SUBROUTINE ext_esmf_put_var_td_real 

!--- get_var_td_double
SUBROUTINE ext_esmf_get_var_td_double ( DataHandle,Element,  DateStr,Varname, Data, Count, Outcount, Status )
  USE module_ext_esmf
  IMPLICIT NONE
  INTEGER ,       INTENT(IN)  :: DataHandle
  CHARACTER*(*) :: Element
  CHARACTER*(*) :: DateStr
  CHARACTER*(*) :: VarName 
  real*8 ,            INTENT(OUT) :: Data(*)
  INTEGER ,       INTENT(IN)  :: Count
  INTEGER ,       INTENT(OUT)  :: OutCount
  INTEGER ,       INTENT(OUT) :: Status
  CALL wrf_debug(1,'ext_esmf_get_var_td_double not supported yet')
  Status = WRF_WARN_NOTSUPPORTED
  RETURN
END SUBROUTINE ext_esmf_get_var_td_double 

!--- put_var_td_double
SUBROUTINE ext_esmf_put_var_td_double ( DataHandle,Element,  DateStr,Varname, Data, Count,  Status )
  USE module_ext_esmf
  IMPLICIT NONE
  INTEGER ,       INTENT(IN)  :: DataHandle
  CHARACTER*(*) :: Element
  CHARACTER*(*) :: DateStr
  CHARACTER*(*) :: VarName 
  real*8 ,            INTENT(IN) :: Data(*)
  INTEGER ,       INTENT(IN)  :: Count
  INTEGER ,       INTENT(OUT) :: Status
  CALL wrf_debug(1,'ext_esmf_put_var_td_double not supported yet')
  Status = WRF_WARN_NOTSUPPORTED
  RETURN
END SUBROUTINE ext_esmf_put_var_td_double 

!--- get_var_td_integer
SUBROUTINE ext_esmf_get_var_td_integer ( DataHandle,Element,  DateStr,Varname, Data, Count, Outcount, Status )
  USE module_ext_esmf
  IMPLICIT NONE
  INTEGER ,       INTENT(IN)  :: DataHandle
  CHARACTER*(*) :: Element
  CHARACTER*(*) :: DateStr
  CHARACTER*(*) :: VarName 
  integer ,            INTENT(OUT) :: Data(*)
  INTEGER ,       INTENT(IN)  :: Count
  INTEGER ,       INTENT(OUT)  :: OutCount
  INTEGER ,       INTENT(OUT) :: Status
  CALL wrf_debug(1,'ext_esmf_get_var_td_integer not supported yet')
  Status = WRF_WARN_NOTSUPPORTED
  RETURN
END SUBROUTINE ext_esmf_get_var_td_integer 

!--- put_var_td_integer
SUBROUTINE ext_esmf_put_var_td_integer ( DataHandle,Element,  DateStr,Varname, Data, Count,  Status )
  USE module_ext_esmf
  IMPLICIT NONE
  INTEGER ,       INTENT(IN)  :: DataHandle
  CHARACTER*(*) :: Element
  CHARACTER*(*) :: DateStr
  CHARACTER*(*) :: VarName 
  integer ,            INTENT(IN) :: Data(*)
  INTEGER ,       INTENT(IN)  :: Count
  INTEGER ,       INTENT(OUT) :: Status
  CALL wrf_debug(1,'ext_esmf_put_var_td_integer not supported yet')
  Status = WRF_WARN_NOTSUPPORTED
  RETURN
END SUBROUTINE ext_esmf_put_var_td_integer 

!--- get_var_td_logical
SUBROUTINE ext_esmf_get_var_td_logical ( DataHandle,Element,  DateStr,Varname, Data, Count, Outcount, Status )
  USE module_ext_esmf
  IMPLICIT NONE
  INTEGER ,       INTENT(IN)  :: DataHandle
  CHARACTER*(*) :: Element
  CHARACTER*(*) :: DateStr
  CHARACTER*(*) :: VarName 
  logical ,            INTENT(OUT) :: Data(*)
  INTEGER ,       INTENT(IN)  :: Count
  INTEGER ,       INTENT(OUT)  :: OutCount
  INTEGER ,       INTENT(OUT) :: Status
  CALL wrf_debug(1,'ext_esmf_get_var_td_logical not supported yet')
  Status = WRF_WARN_NOTSUPPORTED
  RETURN
END SUBROUTINE ext_esmf_get_var_td_logical 

!--- put_var_td_logical
SUBROUTINE ext_esmf_put_var_td_logical ( DataHandle,Element,  DateStr,Varname, Data, Count,  Status )
  USE module_ext_esmf
  IMPLICIT NONE
  INTEGER ,       INTENT(IN)  :: DataHandle
  CHARACTER*(*) :: Element
  CHARACTER*(*) :: DateStr
  CHARACTER*(*) :: VarName 
  logical ,            INTENT(IN) :: Data(*)
  INTEGER ,       INTENT(IN)  :: Count
  INTEGER ,       INTENT(OUT) :: Status
  CALL wrf_debug(1,'ext_esmf_put_var_td_logical not supported yet')
  Status = WRF_WARN_NOTSUPPORTED
  RETURN
END SUBROUTINE ext_esmf_put_var_td_logical 

!--- get_var_td_char
SUBROUTINE ext_esmf_get_var_td_char ( DataHandle,Element,  DateStr,Varname, Data,  Status )
  USE module_ext_esmf
  IMPLICIT NONE
  INTEGER ,       INTENT(IN)  :: DataHandle
  CHARACTER*(*) :: Element
  CHARACTER*(*) :: DateStr
  CHARACTER*(*) :: VarName 
  CHARACTER*(*) :: Data
  INTEGER ,       INTENT(OUT) :: Status
  CALL wrf_debug(1,'ext_esmf_get_var_td_char not supported yet')
  Status = WRF_WARN_NOTSUPPORTED
  RETURN
END SUBROUTINE ext_esmf_get_var_td_char 

!--- put_var_td_char
SUBROUTINE ext_esmf_put_var_td_char ( DataHandle,Element,  DateStr,Varname, Data,  Status )
  USE module_ext_esmf
  IMPLICIT NONE
  INTEGER ,       INTENT(IN)  :: DataHandle
  CHARACTER*(*) :: Element
  CHARACTER*(*) :: DateStr
  CHARACTER*(*) :: VarName 
  CHARACTER*(*) :: Data
  INTEGER ,       INTENT(OUT) :: Status
  CALL wrf_debug(1,'ext_esmf_put_var_td_char not supported yet')
  Status = WRF_WARN_NOTSUPPORTED
  RETURN
END SUBROUTINE ext_esmf_put_var_td_char 
Back to Top