1 | PROGRAM get_field_npp |
---|
2 | !-------------------------------------------------------------- |
---|
3 | ! get the emissions and interpolate on the final grid |
---|
4 | !-------------------------------------------------------------- |
---|
5 | ! USE final_grid_lmdz |
---|
6 | ! USE grid |
---|
7 | ! USE sflx |
---|
8 | |
---|
9 | IMPLICIT NONE |
---|
10 | |
---|
11 | INCLUDE 'netcdf.inc' |
---|
12 | |
---|
13 | !-------------------------------------------------------------- |
---|
14 | ! ... Dummy arguments |
---|
15 | !-------------------------------------------------------------- |
---|
16 | ! CHARACTER(LEN=*), INTENT(in) :: filename |
---|
17 | CHARACTER(LEN=20) :: filename |
---|
18 | |
---|
19 | !-------------------------------------------------------------- |
---|
20 | ! ... Local variables |
---|
21 | !-------------------------------------------------------------- |
---|
22 | INTEGER :: iret |
---|
23 | INTEGER :: error |
---|
24 | INTEGER :: ncid |
---|
25 | INTEGER :: varid |
---|
26 | INTEGER :: nrecs !from module |
---|
27 | INTEGER :: klon_init !from module |
---|
28 | REAL, allocatable, DIMENSION(:,:) :: npp_phy, npp_phy_1x1 !from module |
---|
29 | ! REAL :: workin (klon_init,nlev_len, nrecs) |
---|
30 | |
---|
31 | filename="npp_phy_1x1.nc" |
---|
32 | PRINT *,'Read field from file' , filename(:LEN_TRIM(filename)) |
---|
33 | |
---|
34 | ! ... Open the file |
---|
35 | iret = nf_open(filename, 0, ncid) |
---|
36 | CALL check_err(iret) |
---|
37 | |
---|
38 | iret = nf_inq_dimid(ncid, 'time', varid) |
---|
39 | CALL check_err(iret) |
---|
40 | iret = nf_inq_dimlen(ncid, varid, nrecs) |
---|
41 | CALL check_err(iret) |
---|
42 | print*,'nrecs',nrecs |
---|
43 | |
---|
44 | |
---|
45 | iret = nf_inq_dimid(ncid, 'vector', varid) |
---|
46 | CALL check_err(iret) |
---|
47 | iret = nf_inq_dimlen(ncid, varid, klon_init) |
---|
48 | CALL check_err(iret) |
---|
49 | print*,'klon_init',klon_init |
---|
50 | |
---|
51 | ALLOCATE(npp_phy(klon_init,nrecs), STAT=error) |
---|
52 | |
---|
53 | iret = nf_inq_varid(ncid, 'npp', varid) |
---|
54 | CALL check_err(iret) |
---|
55 | iret = nf_get_var_real(ncid, varid, npp_phy) |
---|
56 | CALL check_err(iret) |
---|
57 | |
---|
58 | ! print*,npp_phy(1,1) |
---|
59 | |
---|
60 | ! ... Close the file |
---|
61 | iret = nf_close(ncid) |
---|
62 | CALL check_err(iret) |
---|
63 | |
---|
64 | |
---|
65 | END PROGRAM get_field_npp |
---|
66 | |
---|