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 its id. It |
! This subroutine defines a vertical axis and returns its id. It |
11 |
! gives the user the possibility to define many different vertical |
! gives the user the possibility to define different vertical |
12 |
! axes. For each variable defined with histdef a vertical axis can |
! axes. For each variable defined with histdef a vertical axis can |
13 |
! be specified by its ID. |
! be specified by its ID. |
14 |
|
|
|
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 |
INTEGER, INTENT(IN):: pfileid |
24 |
! ID of the file the variable should be archived in |
! ID of the file the variable should be archived in |
25 |
|
|
|
INTEGER, INTENT(IN):: pzsize ! size of the vertical axis |
|
26 |
CHARACTER(len=*), INTENT(IN):: pzaxname ! name of the vertical axis |
CHARACTER(len=*), INTENT(IN):: pzaxname ! name of the vertical axis |
|
CHARACTER(len=*), INTENT(IN):: pzaxunit ! units of the vertical axis |
|
27 |
CHARACTER(len=*), INTENT(IN):: pzaxtitle ! title of the vertical axis |
CHARACTER(len=*), INTENT(IN):: pzaxtitle ! title of the vertical axis |
28 |
REAL, INTENT(IN):: pzvalues(pzsize) ! coordinate values of the vetical axis |
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) |
INTEGER, INTENT(OUT):: pzaxid ! ID of the axis (not the netCDF ID) |
34 |
|
|
35 |
CHARACTER(len=*), INTENT(IN), OPTIONAL:: pdirect |
CHARACTER(len=*), INTENT(IN), OPTIONAL:: pdirect |
36 |
! positive direction of the axis: up or down |
! positive direction of the axis: up or down |
37 |
|
|
38 |
! Local: |
! 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) |
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) |