[2759] | 1 | program testread_john |
---|
| 2 | use wrf_data_pnc |
---|
| 3 | implicit none |
---|
| 4 | include 'wrf_status_codes.h' |
---|
| 5 | include 'netcdf.inc' |
---|
| 6 | character (80) FileName |
---|
| 7 | integer Comm |
---|
| 8 | character (80) SysDepInfo |
---|
| 9 | integer :: DataHandle |
---|
| 10 | integer Status |
---|
| 11 | integer NCID |
---|
| 12 | real data(200) |
---|
| 13 | integer idata(200) |
---|
| 14 | real*8 ddata(200) |
---|
| 15 | logical ldata(200) |
---|
| 16 | character (80) cdata |
---|
| 17 | integer OutCount |
---|
| 18 | integer i,j,k |
---|
| 19 | |
---|
| 20 | integer, parameter :: pad = 3 |
---|
| 21 | integer, parameter :: jds=1 , jde=6 , & |
---|
| 22 | ids=1 , ide=9 , & |
---|
| 23 | kds=1 , kde=5 |
---|
| 24 | integer, parameter :: jms=jds-pad , jme=jde+pad , & |
---|
| 25 | ims=ids-pad , ime=ide+pad , & |
---|
| 26 | kms=kds , kme=kde |
---|
| 27 | integer, parameter :: jps=jds , jpe=jde , & |
---|
| 28 | ips=ids , ipe=ide , & |
---|
| 29 | kps=kds , kpe=kde |
---|
| 30 | |
---|
| 31 | real u( ims:ime , kms:kme , jms:jme ) |
---|
| 32 | real v( ims:ime , kms:kme , jms:jme ) |
---|
| 33 | real rho( ims:ime , kms:kme , jms:jme ) |
---|
| 34 | real u2( ims:ime , jms:jme ) |
---|
| 35 | real u1( ims:ime ) |
---|
| 36 | |
---|
| 37 | integer int( ims:ime , kms:kme , jms:jme ) |
---|
| 38 | real*8 r8 ( ims:ime , kms:kme , jms:jme ) |
---|
| 39 | |
---|
| 40 | integer Dom |
---|
| 41 | character*3 MemOrd |
---|
| 42 | integer , Dimension(3) :: DomS,DomE,MemS,MemE,PatS,PatE |
---|
| 43 | integer , Dimension(2) :: Dom2S,Dom2E,Mem2S,Mem2E,Pat2S,Pat2E |
---|
| 44 | integer Dom1S,Dom1E,Mem1S,Mem1E,Pat1S,Pat1E |
---|
| 45 | character (19) Time, DateStr |
---|
| 46 | character (31) VarName |
---|
| 47 | character (19) Date |
---|
| 48 | |
---|
| 49 | print *, 'Testing wrf read' |
---|
| 50 | Date = '2000-09-18_16:42:01' |
---|
| 51 | call ext_init(Status) |
---|
| 52 | print *,'After call ext_init, Status =',Status |
---|
| 53 | FileName = 'foo.nc' |
---|
| 54 | Comm = 1 |
---|
| 55 | SysDepInfo = 'sys info' |
---|
| 56 | call ext_open_for_read( FileName, Comm, SysDepInfo, DataHandle, Status) |
---|
| 57 | print *, 'Status = ',Status,DataHandle |
---|
| 58 | |
---|
| 59 | MemOrd = "XZY" |
---|
| 60 | |
---|
| 61 | DomS(1) = ids |
---|
| 62 | DomE(1) = ide |
---|
| 63 | DomS(2) = kds |
---|
| 64 | DomE(2) = kde |
---|
| 65 | DomS(3) = jds |
---|
| 66 | DomE(3) = jde |
---|
| 67 | |
---|
| 68 | PatS(1) = ips |
---|
| 69 | PatE(1) = ipe |
---|
| 70 | PatS(2) = kps |
---|
| 71 | PatE(2) = kpe |
---|
| 72 | PatS(3) = jps |
---|
| 73 | PatE(3) = jpe |
---|
| 74 | |
---|
| 75 | MemS(1) = ims |
---|
| 76 | MemE(1) = ime |
---|
| 77 | MemS(2) = kms |
---|
| 78 | MemE(2) = kme |
---|
| 79 | MemS(3) = jms |
---|
| 80 | MemE(3) = jme |
---|
| 81 | |
---|
| 82 | Dom2S(1) = ids |
---|
| 83 | Dom2S(2) = jds |
---|
| 84 | Dom2E(1) = ide |
---|
| 85 | Dom2E(2) = jde |
---|
| 86 | Mem2S(1) = ims |
---|
| 87 | Mem2S(2) = jms |
---|
| 88 | Mem2E(1) = ime |
---|
| 89 | Mem2E(2) = jme |
---|
| 90 | Pat2S(1) = ips |
---|
| 91 | Pat2S(2) = jps |
---|
| 92 | Pat2E(1) = ipe |
---|
| 93 | Pat2E(2) = jpe |
---|
| 94 | |
---|
| 95 | Dom1S = ids |
---|
| 96 | Dom1E = ide |
---|
| 97 | Mem1S = ims |
---|
| 98 | Mem1E = ime |
---|
| 99 | Pat1S = ips |
---|
| 100 | Pat1E = ipe |
---|
| 101 | |
---|
| 102 | call ext_get_next_time(DataHandle, Time, Status) |
---|
| 103 | print *, Time, Status |
---|
| 104 | |
---|
| 105 | call ext_read_field(DataHandle,Time,'u',u,WRF_REAL,Comm,Dom,MemOrd,DomS,DomE,MemS,MemE,PatS,PatE,Status) |
---|
| 106 | print *,'ext_read_field Status = ',Status, ' u(2,3,4) ', u(2,3,4) |
---|
| 107 | call ext_read_field(DataHandle,Time,'v',v,WRF_REAL,Comm,Dom,MemOrd,DomS,DomE,MemS,MemE,PatS,PatE,Status) |
---|
| 108 | print *,'ext_read_field Status = ',Status, ' v(4,3,2) ', v(4,3,2) |
---|
| 109 | call ext_read_field(DataHandle,Time,'rho',rho,WRF_REAL,Comm,Dom,MemOrd,DomS,DomE,MemS,MemE,PatS,PatE,Status) |
---|
| 110 | print *,'ext_read_field Status = ',Status, ' rho(3,4,5) ' , rho(3,4,5) |
---|
| 111 | call ext_read_field(DataHandle,Date,'u2',u2,WRF_REAL,Comm,Dom,'XY',Dom2S,Dom2E,Mem2S,Mem2E,Pat2S,Pat2E,Status) |
---|
| 112 | print *,'ext_read_field Status = ',Status, ' u2(6,5) ', u2(6,5) |
---|
| 113 | call ext_read_field(DataHandle,Date,'ud2',u,WRF_REAL,Comm,Dom,"XzY",DomS,DomE,MemS,MemE,PatS,PatE,Status) |
---|
| 114 | print *,'ext_read_field Status = ',Status, ' u(2,3,4) ', u(2,3,4) |
---|
| 115 | call ext_read_field(DataHandle,Date,'u1',u1,WRF_REAL,Comm,Dom,'Z',Dom1S,Dom1E,Mem1S,Mem1E,Pat1S,Pat1E,Status) |
---|
| 116 | print *,'ext_read_field Status = ',Status, ' u1(9) ', u1(9) |
---|
| 117 | |
---|
| 118 | call ext_read_field(DataHandle,Time,'int',int,WRF_INTEGER,Comm,Dom,MemOrd,DomS,DomE,MemS,MemE,PatS,PatE,Status) |
---|
| 119 | print *,'ext_read_field Status = ',Status, ' int(8,5,6) ', int(8,5,6) |
---|
| 120 | call ext_read_field(DataHandle,Time,'double',r8,WRF_DOUBLE,Comm,Dom,MemOrd,DomS,DomE,MemS,MemE,PatS,PatE,Status) |
---|
| 121 | print *,'ext_read_field Status = ',Status, ' r8(7,4,5) ', r8(7,4,5) |
---|
| 122 | |
---|
| 123 | call ext_get_next_time(DataHandle, Time, Status) |
---|
| 124 | print *, Time, Status |
---|
| 125 | |
---|
| 126 | call ext_read_field(DataHandle,Time,'u',u,WRF_REAL,Comm,Dom,MemOrd,DomS,DomE,MemS,MemE,PatS,PatE,Status) |
---|
| 127 | print *,'> ext_read_field Status = ',Status, ' u(3,3,3) ' ,u(3,3,3) |
---|
| 128 | call ext_read_field(DataHandle,Time,'v',v,WRF_REAL,Comm,Dom,MemOrd,DomS,DomE,MemS,MemE,PatS,PatE,Status) |
---|
| 129 | print *,'> ext_read_field Status = ',Status, ' v(4,4,4) ' ,v(4,4,4) |
---|
| 130 | call ext_read_field(DataHandle,Time,'rho',rho,WRF_REAL,Comm,Dom,MemOrd,DomS,DomE,MemS,MemE,PatS,PatE,Status) |
---|
| 131 | print *,'> ext_read_field Status = ',Status, ' rho(3,4,5) ' ,rho(3,4,5) |
---|
| 132 | |
---|
| 133 | call ext_close( DataHandle, Status) |
---|
| 134 | print *, 'After ext_close, Status = ',Status |
---|
| 135 | call ext_exit(Status) |
---|
| 136 | print *,'End of test program',Status |
---|
| 137 | stop |
---|
| 138 | end program testread_john |
---|