4 |
|
|
5 |
contains |
contains |
6 |
|
|
7 |
SUBROUTINE histvert(pfileid, pzaxname, pzaxtitle, pzaxunit, pzsize, & |
SUBROUTINE histvert(pfileid, pzaxname, pzaxtitle, pzaxunit, pzvalues, & |
8 |
pzvalues, pzaxid, pdirect) |
pzaxid, pdirect) |
9 |
|
|
10 |
! This subroutine defines a vertical axis and returns it s id. |
! This subroutine defines a vertical axis and returns its id. It |
11 |
! It gives the user the possibility to the user to define many |
! gives the user the possibility to define different vertical |
12 |
! different vertical axes. For each variable defined with histdef a |
! axes. For each variable defined with histdef a vertical axis can |
13 |
! vertical axis can be specified with by it s ID. |
! be specified by its ID. |
|
|
|
|
! INPUT |
|
|
|
|
|
! pfileid: ID of the file the variable should be archived in |
|
|
! pzaxname: Name of the vertical axis |
|
|
! pzaxtitle: title of the vertical axis |
|
|
! pzaxunit: Units of the vertical axis |
|
|
! pzsize: size of the vertical axis |
|
|
! pzvalues: Coordinate values of the vetical axis |
|
|
|
|
|
! pdirect: is an optional argument which allows to specify the |
|
|
! the positive direction of the axis: up or down. |
|
|
! OUTPUT |
|
14 |
|
|
|
! pzaxid: Returns the ID of the axis. |
|
|
! Note that this is not the netCDF ID ! |
|
|
|
|
|
USE find_str_m, ONLY: find_str |
|
|
USE strlowercase_m, ONLY: strlowercase |
|
15 |
USE errioipsl, ONLY: histerr |
USE errioipsl, ONLY: histerr |
16 |
|
USE find_str_m, ONLY: find_str |
17 |
USE histcom_var, ONLY: nb_zax, nb_zax_max, ncdf_ids, zax_ids, & |
USE histcom_var, ONLY: nb_zax, nb_zax_max, ncdf_ids, zax_ids, & |
18 |
zax_name, zax_name_length, zax_size |
zax_name, zax_name_length, zax_size |
19 |
USE netcdf, ONLY: nf90_def_dim, nf90_def_var, nf90_enddef, & |
USE netcdf, ONLY: nf90_def_dim, nf90_def_var, nf90_enddef, & |
20 |
nf90_float, nf90_put_att, nf90_put_var, nf90_redef |
nf90_float, nf90_put_att, nf90_put_var, nf90_redef |
21 |
|
USE strlowercase_m, ONLY: strlowercase |
22 |
|
|
23 |
INTEGER, INTENT (IN):: pfileid, pzsize |
INTEGER, INTENT(IN):: pfileid |
24 |
CHARACTER (len=*), INTENT (IN):: pzaxname, pzaxunit, pzaxtitle |
! ID of the file the variable should be archived in |
|
REAL, INTENT (IN):: pzvalues(pzsize) |
|
|
INTEGER, INTENT (OUT):: pzaxid |
|
|
CHARACTER (len=*), INTENT (IN), OPTIONAL:: pdirect |
|
25 |
|
|
26 |
|
CHARACTER(len=*), INTENT(IN):: pzaxname ! name of the vertical axis |
27 |
|
CHARACTER(len=*), INTENT(IN):: pzaxtitle ! title of the vertical axis |
28 |
|
CHARACTER(len=*), INTENT(IN):: pzaxunit ! units of the vertical axis |
29 |
|
|
30 |
|
REAL, INTENT(IN):: pzvalues(:) ! (pzsize) |
31 |
|
! coordinate values of the vertical axis |
32 |
|
|
33 |
|
INTEGER, INTENT(OUT):: pzaxid ! ID of the axis (not the netCDF ID) |
34 |
|
|
35 |
|
CHARACTER(len=*), INTENT(IN), OPTIONAL:: pdirect |
36 |
|
! positive direction of the axis: up or down |
37 |
|
|
38 |
|
! Local: |
39 |
|
INTEGER pzsize ! size of the vertical axis |
40 |
INTEGER:: pos, iv, nb, zdimid, zaxid_tmp |
INTEGER:: pos, iv, nb, zdimid, zaxid_tmp |
41 |
CHARACTER (len=20):: str20, tab_str20(nb_zax_max) |
CHARACTER(len=20):: str20, tab_str20(nb_zax_max) |
42 |
INTEGER:: tab_str20_length(nb_zax_max) |
INTEGER:: tab_str20_length(nb_zax_max) |
43 |
CHARACTER (len=70):: str70, str71, str72 |
CHARACTER(len=70):: str70, str71, str72 |
44 |
CHARACTER (len=80):: str80 |
CHARACTER(len=80):: str80 |
45 |
CHARACTER (len=20):: direction |
CHARACTER(len=20):: direction |
46 |
INTEGER:: iret, leng, ncid |
INTEGER:: iret, leng, ncid |
47 |
|
|
48 |
!--------------------------------------------------------------------- |
!--------------------------------------------------------------------- |
49 |
|
|
50 |
|
pzsize = size(pzvalues) |
51 |
|
|
52 |
! 1.0 Verifications: |
! 1.0 Verifications: |
53 |
! Do we have enough space for an extra axis ? |
! Do we have enough space for an extra axis ? |
54 |
! Is the name already in use ? |
! Is the name already in use ? |
55 |
|
|
56 |
! - Direction of axis. Can we get if from the user. |
! - Direction of axis. Can we get if from the user. |
57 |
! If not we put unknown. |
! If not we put unknown. |
58 |
|
|
59 |
IF (present(pdirect)) THEN |
IF (present(pdirect)) THEN |
60 |
direction = trim(pdirect) |
direction = trim(pdirect) |
94 |
|
|
95 |
IF (pos>0) THEN |
IF (pos>0) THEN |
96 |
str70 = 'Vertical axis already exists' |
str70 = 'Vertical axis already exists' |
97 |
WRITE (str71, '("Check variable ", a, " in file", I3)') str20, & |
WRITE(str71, '("Check variable ", a, " in file", I3)') str20, & |
98 |
pfileid |
pfileid |
99 |
str72 = 'Can also be a wrong file ID in another declaration' |
str72 = 'Can also be a wrong file ID in another declaration' |
100 |
CALL histerr(3, 'histvert', str70, str71, str72) |
CALL histerr(3, 'histvert', str70, str71, str72) |