Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dm update #15

Open
wants to merge 194 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
194 commits
Select commit Hold shift + click to select a range
e3113eb
First attempt at adding the fms_diag_object to diag manager
thomas-robinson Oct 6, 2021
a9982d8
Second attempt at adding the fms_diag_object to diag manager
thomas-robinson Oct 6, 2021
ce9de8a
Adds diag_object to diag_manager folder and compiles.
thomas-robinson Oct 6, 2021
1ab4eb8
Merge pull request #837 from thomas-robinson/tom-dmUpdate
thomas-robinson Oct 11, 2021
e02fa3d
Merge remote-tracking branch 'origin/main' into dmUpdate
thomas-robinson Oct 20, 2021
98bb81e
Adds namelist variable
thomas-robinson Oct 20, 2021
9c9a406
Adds all variables to diag object that are registered.
thomas-robinson Oct 22, 2021
06a71bb
Merge branch 'diag_object_namelist' into dm-registerObj
thomas-robinson Oct 22, 2021
ccb2583
Registered a bunch of data in the diag_object.
thomas-robinson Oct 22, 2021
5afcd83
Merge pull request #847 from thomas-robinson/diag_object_namelist
thomas-robinson Oct 22, 2021
70b7829
Fixes typos in filling in missing value for diag object registration.
thomas-robinson Oct 25, 2021
7b7541c
Merge branch 'main' of github.com:NOAA-GFDL/FMS into dmUpdate
thomas-robinson Oct 27, 2021
3acef8f
Removes diag_object operator overrides.
thomas-robinson Nov 2, 2021
7c9881b
Merge pull request #850 from thomas-robinson/dm-registerObj
thomas-robinson Nov 2, 2021
e24ccfd
Initial add of fms_diag_yaml_object.F90
thomas-robinson Nov 3, 2021
dce9d96
Merge remote-tracking branch 'origin/dmUpdate' into dmUpdate
thomas-robinson Nov 8, 2021
4dbe01a
Merge branch 'dm-yamlfile' into dmUpdate
thomas-robinson Nov 8, 2021
a0dfa42
Merge remote-tracking branch 'origin/main' into dmUpdate
thomas-robinson Nov 10, 2021
00988c1
Updates fms_c2f_string to convert C-string and C-pointers to a Fortra…
thomas-robinson Nov 10, 2021
fd8e98b
Removes pure functionality for string conversions
thomas-robinson Nov 10, 2021
0cc676f
Merge branch 'c2fstring_update' into dmUpdate
thomas-robinson Nov 11, 2021
67e1e96
Fixes compile errors in new diag manager related to objects
thomas-robinson Nov 11, 2021
2322990
Merge branch 'main' of github.com:NOAA-GFDL/FMS into dmUpdate
thomas-robinson Nov 15, 2021
1c2ba17
Updates doxygen on string conversion interface
thomas-robinson Nov 15, 2021
ea0495c
Merge branch 'main' into c2fstring_update
thomas-robinson Nov 15, 2021
a37817a
Merge branch 'c2fstring_update' of https://github.com/thomas-robinson…
thomas-robinson Nov 15, 2021
b32b3db
Merge branch 'dmUpdate' of github.com:NOAA-GFDL/FMS into dmUpdate
thomas-robinson Nov 15, 2021
d2708c8
Merge pull request #853 from thomas-robinson/dmUpdate
thomas-robinson Nov 16, 2021
440f58e
Updates get functions in the diag yaml objects
thomas-robinson Nov 29, 2021
c30d360
Merge pull request #864 from thomas-robinson/updateGets
thomas-robinson Nov 30, 2021
2a2d9d2
Merge branch 'main' into dmUpdate
thomas-robinson Dec 13, 2021
9f261fa
diag_yaml addition (#866)
uramirez8707 Dec 28, 2021
acd73c7
Merge remote-tracking branch 'origin' into dmUpdate
thomas-robinson Jan 4, 2022
60c5e12
Adding the fms_diag_object container. (#867)
ngs333 Jan 4, 2022
164e870
Skipping tests of container and linked list. (#882)
ngs333 Jan 10, 2022
ad7a14f
Changes fms_diag_object to fmsDiagObject_type (#879)
thomas-robinson Jan 10, 2022
3b6af65
Merge branch 'main' into dmUpdate
thomas-robinson Jan 10, 2022
baf9fb1
Merge branch 'main' into dmUpdate
thomas-robinson Jan 12, 2022
2c218d0
Dm update: diag_yaml_object_init() tests (#883)
uramirez8707 Jan 12, 2022
08205c6
Dm get fns (#885)
thomas-robinson Feb 7, 2022
1e6cb52
diag_manager ontainer and linked list -test core dump fixes and more …
ngs333 Feb 7, 2022
3b9dde3
Moves fms_diag_yaml_obj to fms_diag_yaml (#887)
uramirez8707 Feb 7, 2022
9ea4892
Merge remote-tracking branch 'origin/main' into dmUpdate
thomas-robinson Feb 7, 2022
54bdaf6
Merge branch 'main' into dmUpdate
thomas-robinson Feb 11, 2022
0768cfc
Dm update (#913)
ngs333 Feb 17, 2022
d0cffcb
Merge remote-tracking branch 'origin/main' into dmUpdate
thomas-robinson Feb 25, 2022
8354493
Removes intel18 testing due to a compiler issue (#915)
thomas-robinson Feb 25, 2022
8165679
diag_yaml update (#901)
uramirez8707 Feb 25, 2022
d6324ff
Dm obj alloc (#910)
thomas-robinson Feb 25, 2022
b4346f8
Dm pure (#923)
thomas-robinson Feb 25, 2022
e2f9107
Merge branch 'main' into dmUpdate
thomas-robinson Feb 25, 2022
7658ead
Dm p rupdate (#924)
thomas-robinson Mar 1, 2022
c4ba370
Resolves merge conflict with main due to code coverage
thomas-robinson Mar 2, 2022
207ed12
Resolves conflicts with 2022.01-beta2 and dmUpdate branch #931
uramirez8707 Mar 8, 2022
c994f11
Resolves more merge conflicts with dmUpdate and 2022.01-beta1
thomas-robinson Mar 9, 2022
cd7cf11
Merge branch 'dmUpdate' into dmUpdate2022.01
thomas-robinson Mar 9, 2022
2688ae0
Diag ocean (#927)
uramirez8707 Mar 14, 2022
7547711
Write file var (#936)
uramirez8707 Mar 14, 2022
b3dd78b
Base time (#937)
uramirez8707 Mar 21, 2022
359939a
fms_find_unique (#938)
uramirez8707 Mar 21, 2022
5c10ab8
Remove use_mpp_io from diag manager (#940)
thomas-robinson Mar 23, 2022
f4200fe
Modern register_diag_field set up (#939)
uramirez8707 Mar 24, 2022
b3f31e2
Diag manager init (#944)
uramirez8707 Mar 29, 2022
0ab902a
Merge branch 'main' into dmUpdate
thomas-robinson Mar 30, 2022
cb71efd
Yaml updates (#942)
uramirez8707 Mar 30, 2022
09b9a06
Removes more realm stuff and cleans up white space (#947)
uramirez8707 Apr 1, 2022
f8919fb
Register_diag_field (#950)
uramirez8707 Apr 14, 2022
444bc96
Update supported types in diag_manager (#955)
uramirez8707 Apr 14, 2022
b587b52
Merge main into dmUpdate (#964)
uramirez8707 Apr 20, 2022
f8fb909
Diag axis obj (#966)
uramirez8707 May 11, 2022
2ab6752
Merge branch 'main' into dmUpdate
thomas-robinson May 13, 2022
eef5a19
add number of diurnal sample and power level to the yaml (#977)
uramirez8707 May 16, 2022
7e6baf5
Subregion yaml update (#973)
uramirez8707 May 23, 2022
35e15d0
Diag file object (#943)
thomas-robinson Jun 1, 2022
f38edcc
Diag_axis_init set up (#978)
uramirez8707 Jun 1, 2022
67f97ce
diag_axis io (#982)
uramirez8707 Jun 3, 2022
d0d24f5
Merge branch 'main' into dmUpdate
thomas-robinson Jun 10, 2022
3af3360
Finish register diag (#984)
uramirez8707 Jun 15, 2022
0d92ed3
Adds the module name to find_diag_field and get_diag_fields_entries t…
uramirez8707 Jun 29, 2022
3a69f88
add a modern version of add_diag_axis_attribute (#990)
uramirez8707 Jun 29, 2022
4089269
Diag objs array (#995)
uramirez8707 Jul 5, 2022
4135e31
Merge branch 'main' into dmUpdate
thomas-robinson Jul 8, 2022
70fc6a6
Merge remote-tracking branch 'origin/dmUpdate' into dmUpdate
thomas-robinson Jul 8, 2022
461710e
Merge branch 'main' into dmUpdate
thomas-robinson Jul 14, 2022
9de90bf
Merges 2022.03-beta1 with dmUpdate
thomas-robinson Jul 18, 2022
033b50e
Merge branch 'main' into dmUpdate
thomas-robinson Jul 26, 2022
85d3fa4
class(*) updates needed for compatibility of dmUpdate with 2022.03 (#…
thomas-robinson Jul 26, 2022
0088145
Compiling dmUpdate post merge of 2022.03-beta1 (#979)
ngs333 Jul 26, 2022
fcd8234
Merge branch 'main' into dmUpdate
thomas-robinson Aug 4, 2022
888ec43
Dm update design (#1015)
thomas-robinson Aug 5, 2022
3528354
Add time info to diag file obj (#1002)
uramirez8707 Aug 8, 2022
e455d6b
Modern_diag remaining init work (#998)
uramirez8707 Aug 8, 2022
a1f41a1
Merge branch 'main' into dmUpdate
thomas-robinson Aug 8, 2022
4b7efdc
Modern diag_manager: use integer parameters instead of strings (#1016)
uramirez8707 Aug 15, 2022
fd634d1
Diag field type (#1017)
thomas-robinson Aug 15, 2022
7e3b75b
make type bound procedures private except when through the type (#1022)
rem1776 Aug 16, 2022
d9160dd
Dm update design (#1018)
thomas-robinson Aug 16, 2022
d7931ad
clean up the diag registers (#1023)
uramirez8707 Aug 16, 2022
e8870d4
Modifying several classes to use the "this" in type bound procedures.…
ngs333 Aug 23, 2022
2d1b672
Move axis obj (#1024)
uramirez8707 Sep 13, 2022
f7bc762
Add fms_diag_time_utils.F90 (#1041)
uramirez8707 Sep 15, 2022
f1f88ec
Adds zbounds to the diag_field yaml (#1037)
uramirez8707 Sep 15, 2022
c7c2e04
Dm buffer object (#1019)
rem1776 Oct 4, 2022
e91fb97
diag_manager io: open_file (#1044)
uramirez8707 Oct 4, 2022
bd4c4c6
Merge branch 'main' into dmUpdate
thomas-robinson Oct 4, 2022
b14e664
Dump routines for diag objects (#1048)
rem1776 Oct 7, 2022
25ffcea
Ifdef cleanup (#1049)
thomas-robinson Oct 7, 2022
c5b13ce
add failure test for compiling without yaml + skip empty tests (#1050)
rem1776 Oct 7, 2022
31ed1d8
Merge branch 'main' into dmUpdate
thomas-robinson Oct 31, 2022
1e3e0c0
Subaxis setup (#1056)
uramirez8707 Nov 8, 2022
b9d156f
Merge branch 'main' into dmUpdate
thomas-robinson Nov 8, 2022
e106c29
Add time io (#1068)
uramirez8707 Nov 22, 2022
6b38aec
Merge branch 'main' into dmUpdate
thomas-robinson Nov 23, 2022
b0334fc
Add flexible timining feature in modern diag_manager (#1077)
uramirez8707 Dec 16, 2022
5429283
Merge branch 'main' into dmUpdate
thomas-robinson Jan 25, 2023
7e21a97
Accept data (#1088)
thomas-robinson Jan 25, 2023
af0b3ca
Add some of the io for the field's metadata (#1102)
uramirez8707 Jan 31, 2023
34ef885
Unstructured grid files axis (#1114)
uramirez8707 Feb 1, 2023
8f7b860
Diag table documentation (#1122)
uramirez8707 Feb 2, 2023
fcd02d3
Merge branch 'main' into dmUpdate
thomas-robinson Feb 2, 2023
5b6ee81
Fix race conditions + add send_data tests (#1130)
uramirez8707 Feb 8, 2023
298f630
Merge main into dmupdate (#1134)
rem1776 Feb 14, 2023
6dba8c2
Time io update (#1129)
uramirez8707 Feb 22, 2023
a1f720b
Add the documentation explaining the is_ocean key (#1133)
uramirez8707 Feb 22, 2023
5c6636d
Dm merge fix (#1135)
thomas-robinson Feb 22, 2023
4f1f47e
Resolves Merge conflict with dmUpdate and 2023.01-beta2
thomas-robinson Mar 1, 2023
0b6ccf4
Fixes errors resulting from merge conflict resolution
thomas-robinson Mar 1, 2023
6344086
Fixes another error from the dmUpdate and 2023.01-beta2 merge
thomas-robinson Mar 1, 2023
98468cf
Modern diag_manager: add diurnal axis (#1138)
uramirez8707 Mar 7, 2023
5ce4790
Modern diag manager: add subzaxis (#1148)
uramirez8707 Mar 10, 2023
db4b37d
Dm update 2023.01-beta4 (#1162)
thomas-robinson Mar 22, 2023
6aa2a22
Adds a variable to the diag_object to store the current model time (w…
uramirez8707 Mar 22, 2023
030c1d7
Follow the this convention for object procedures (#1159)
uramirez8707 Mar 22, 2023
cd26058
Modern diag manager: check if field is registered (#1151)
uramirez8707 Mar 29, 2023
4e624dc
Merge conflict resolution with dmUpdate (#1165)
thomas-robinson Apr 5, 2023
2db2887
Dm update2023.01 (#1181)
thomas-robinson Apr 6, 2023
7626d0b
Add a has routine and fixes some type bound procedure formatting (#1182)
ganganoaa Apr 6, 2023
6d01975
fix bounds typo and change get_buffer to reference its argument inste…
rem1776 Apr 6, 2023
e354ae9
store a variable that defines if a variable is a scalar (#1175)
uramirez8707 Apr 6, 2023
e30e4e6
Merge branch 'main' of https://github.com/NOAA-GFDL/FMS into dmUpdate…
uramirez8707 Apr 6, 2023
45e1fd0
fix: rename to add output to buffer names (#1184)
rem1776 Apr 6, 2023
b9b2103
Merge pull request #1185 from uramirez8707/dmUpdate_wut
thomas-robinson Apr 7, 2023
659bc33
add log_diag_field_info to dmUpdate (#1090)
rem1776 Apr 21, 2023
6aebaa8
Modern diag_manager: write out the cell_measures and cell_methods att…
uramirez8707 Apr 21, 2023
b8bf359
Modern diag_manager: Add a function that determine the type of the va…
uramirez8707 Apr 21, 2023
035fff2
Modern diag_manager: Add standard_name and coordinates attributes + m…
uramirez8707 Apr 25, 2023
8e9ca97
Update to fms_diag_yaml_mod (#1186)
ganganoaa Apr 25, 2023
844ed3f
Documentation update to dmUpdate branch (#1161)
ganganoaa Apr 25, 2023
bb25a07
Modern diag_manager: Fixes related to static and scalar fields (#1188)
uramirez8707 Apr 26, 2023
65a962b
Adds allocate_diag_field_output_buffers() to fms_diag_object_mod (#1198)
ganganoaa May 3, 2023
3754f89
Adds a function, check_indices_order(), to diag_util_mod (#1203)
ganganoaa May 3, 2023
1f5a36d
Add real_copy_set to diag_util_mod (#1204)
ganganoaa May 3, 2023
de83a75
Adds routine init_mask_3d() to diag_util_mod (#1201)
ganganoaa May 10, 2023
5888045
Initializes buffer_ids and buffer_allocated (#1210)
ganganoaa May 31, 2023
ae01d4b
Adds fms_diag_compare_window() to fmsDiagObject_type (#1230)
ganganoaa May 31, 2023
75228b0
Write global/variable attributes defined in the yaml + subregional fi…
uramirez8707 Jun 28, 2023
8dd4136
Updates function fms_diag_output_buffer_mod::remap_buffer (#1260)
ganganoaa Jun 28, 2023
de08b87
Fixes merge conflict with 2023.02-aplha3 and dmUpdate
thomas-robinson Jul 5, 2023
7b2e915
Removed mpp_io_init from test_diag_dlinked_list
thomas-robinson Jul 6, 2023
d5ea517
Removes mpp_io from test_diag_object_container
thomas-robinson Jul 6, 2023
58a7599
2023.02 alpha3 dm update (#1274)
thomas-robinson Jul 6, 2023
1c39a6a
Merge branch 'main' into dmUpdate
thomas-robinson Jul 12, 2023
428e183
fix incorrect type values and static kind sizes (#1263)
rem1776 Jul 12, 2023
9e82c4b
Yaml update (#1269)
uramirez8707 Jul 13, 2023
95c761d
Add axis ids to the buffer object (#1278)
uramirez8707 Jul 13, 2023
dbf1917
Adds function recondition_indices to diag_util_mod (#1207)
ganganoaa Jul 14, 2023
a6bc9a5
Merge branch 'main' into dmUpdate
thomas-robinson Jul 24, 2023
7c763af
Add diag_manager testing for openmp (#1281)
uramirez8707 Jul 31, 2023
4cb075e
diag_field_not_found (#1301)
uramirez8707 Jul 31, 2023
bfe4cad
Write buffer prep (#1311)
uramirez8707 Aug 1, 2023
07ec8cf
Calls allocate_diag_field_output_buffers (#1314)
uramirez8707 Aug 7, 2023
639b0ed
resolves conflicts in test_fms/diag_manager/test_diag_manager2.sh
thomas-robinson Aug 9, 2023
8458bfd
modern_diag: add the write_data calls (#1320)
uramirez8707 Aug 11, 2023
f28b99b
modern_diag_manager: fms_diag_do_reduction (#1321)
uramirez8707 Aug 11, 2023
28124ae
Modern diag manager: Refactor buffers (#1332)
uramirez8707 Aug 15, 2023
4e4d183
changes all fms2 fileobj instances to fms2io_fileobj (#1333)
mcallic2 Aug 15, 2023
15241dc
modern diag manager: Add more tests (#1335)
uramirez8707 Aug 16, 2023
07ff067
Implement time_none (#1347)
uramirez8707 Aug 24, 2023
3e4faad
modern_diag_manager: Update output_buffer_obj (#1354)
uramirez8707 Sep 8, 2023
39e6cb2
dmupdate: change type of buffer counter (#1315)
rem1776 Sep 8, 2023
e6d8132
Modern diag manager: Input buffer obj (#1362)
uramirez8707 Sep 13, 2023
b9dc3b6
Modern_diag_manager- min/max (#1367)
uramirez8707 Sep 19, 2023
b1fc87d
feat: changes `fileobj` to `yaml_fileobj` (#1334)
mcallic2 Sep 27, 2023
c04e921
add time sum reduction to dmUpdate (#1375)
rem1776 Oct 11, 2023
99822ba
fix: diag_send_complete loops and add get_file_ids (#1407)
rem1776 Nov 15, 2023
df5d291
move mask from input buffer object to field object (#1411)
rem1776 Nov 20, 2023
26aa42f
Modern_diag_manager:: send data 4d (#1402)
uramirez8707 Nov 20, 2023
8d6373d
Dm update main (#1422)
uramirez8707 Nov 30, 2023
0cd1174
Merge remote-tracking branch 'origin/main' into dmUpdate
Dec 15, 2023
4b5cc42
fix build issues
Dec 15, 2023
fbc6a6e
fix name used for makefile conditionals in tracer and field manager t…
Dec 15, 2023
354cc51
add missing imports from update diag code
Dec 15, 2023
862a59d
fix conditionals in test scripts
Dec 15, 2023
2d44140
merge main into dmUpdate (#1426)
thomas-robinson Dec 18, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Unstructured grid files axis (NOAA-GFDL#1114)
* adds the compress attribute and axis data to the netcdf file

* Fix some typos, change axis_length to a required argument, change the structured_axis to allocatables
uramirez8707 authored Feb 1, 2023

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
commit 34ef885b855a4420640beb67f0b830a87d98b8a4
8 changes: 5 additions & 3 deletions diag_manager/diag_axis.F90
Original file line number Diff line number Diff line change
@@ -138,9 +138,11 @@ INTEGER FUNCTION diag_axis_init(name, DATA, units, cart_name, long_name, directi
ENDIF

if (use_modern_diag) then
diag_axis_init = fms_diag_object%fms_diag_axis_init(name, DATA, units, cart_name, long_name=long_name,&
& direction=direction, set_name=set_name, edges=edges, Domain=Domain, Domain2=Domain2, DomainU=DomainU, &
& aux=aux, req=req, tile_count=tile_count, domain_position=domain_position )
!TODO Passing in the axis_length because of a gnu issue where inside fms_diag_axis_init, the size of DATA
!was 2 which was causing the axis_data to not be written correctly...
diag_axis_init = fms_diag_object%fms_diag_axis_init(name, DATA, units, cart_name, size(DATA(:)), &
& long_name=long_name, direction=direction, set_name=set_name, edges=edges, Domain=Domain, Domain2=Domain2, &
& DomainU=DomainU, aux=aux, req=req, tile_count=tile_count, domain_position=domain_position)
return
endif
IF ( PRESENT(tile_count)) THEN
108 changes: 97 additions & 11 deletions diag_manager/fms_diag_axis_object.F90
Original file line number Diff line number Diff line change
@@ -49,7 +49,7 @@ module fms_diag_axis_object_mod
public :: fmsDiagAxis_type, fms_diag_axis_object_init, fms_diag_axis_object_end, &
& get_domain_and_domain_type, diagDomain_t, &
& DIAGDOMAIN2D_T, fmsDiagSubAxis_type, fmsDiagAxisContainer_type, fmsDiagFullAxis_type, DIAGDOMAINUG_T
public :: define_new_axis, define_subaxis
public :: define_new_axis, define_subaxis, parse_compress_att, get_axis_id_from_name

!> @}

@@ -96,6 +96,9 @@ module fms_diag_axis_object_mod
procedure :: get_axis_name
procedure :: write_axis_metadata
procedure :: write_axis_data
procedure :: add_structured_axis_ids
procedure :: get_structured_axis
procedure :: is_unstructured_grid
END TYPE fmsDiagAxis_type

!> @brief Type to hold the subaxis
@@ -138,6 +141,8 @@ module fms_diag_axis_object_mod
TYPE(fmsDiagAttribute_type),allocatable , private :: attributes(:) !< Array to hold user definable attributes
INTEGER , private :: num_attributes !< Number of defined attibutes
INTEGER , private :: domain_position !< The position in the doman (NORTH, EAST or CENTER)
integer, allocatable , private :: structured_ids(:) !< If the axis is in the unstructured grid,
!! this is the axis ids of the structured axis

contains

@@ -160,7 +165,7 @@ module fms_diag_axis_object_mod
!!!!!!!!!!!!!!!!! DIAG AXIS PROCEDURES !!!!!!!!!!!!!!!!!
!> @brief Initialize the axis
subroutine register_diag_axis_obj(this, axis_name, axis_data, units, cart_name, long_name, direction,&
& set_name, Domain, Domain2, DomainU, aux, req, tile_count, domain_position )
& set_name, Domain, Domain2, DomainU, aux, req, tile_count, domain_position, axis_length )
class(fmsDiagFullAxis_type),INTENT(out) :: this !< Diag_axis obj
CHARACTER(len=*), INTENT(in) :: axis_name !< Name of the axis
class(*), INTENT(in) :: axis_data(:) !< Array of coordinate values
@@ -177,6 +182,7 @@ subroutine register_diag_axis_obj(this, axis_name, axis_data, units, cart_name,
CHARACTER(len=*), INTENT(in), OPTIONAL :: req !< Required field names.
INTEGER, INTENT(in), OPTIONAL :: tile_count !< Number of tiles
INTEGER, INTENT(in), OPTIONAL :: domain_position !< Domain position, "NORTH" or "EAST"
integer, intent(in), optional :: axis_length !< The length of the axis size(axis_data(:))

this%axis_name = trim(axis_name)
this%units = trim(units)
@@ -187,12 +193,14 @@ subroutine register_diag_axis_obj(this, axis_name, axis_data, units, cart_name,

select type (axis_data)
type is (real(kind=r8_kind))
allocate(real(kind=r8_kind) :: this%axis_data(size(axis_data)))
allocate(real(kind=r8_kind) :: this%axis_data(axis_length))
this%axis_data = axis_data
this%length = axis_length
this%type_of_data = "double" !< This is what fms2_io expects in the register_field call
type is (real(kind=r4_kind))
allocate(real(kind=r4_kind) :: this%axis_data(size(axis_data)))
allocate(real(kind=r4_kind) :: this%axis_data(axis_length))
this%axis_data = axis_data
this%length = axis_length
this%type_of_data = "float" !< This is what fms2_io expects in the register_field call
class default
call mpp_error(FATAL, "The axis_data in your diag_axis_init call is not a supported type. &
@@ -226,8 +234,6 @@ subroutine register_diag_axis_obj(this, axis_name, axis_data, units, cart_name,
if (present(domain_position)) this%domain_position = domain_position
call check_if_valid_domain_position(this%domain_position)

this%length = size(axis_data)

this%direction = 0
if (present(direction)) this%direction = direction
call check_if_valid_direction(this%direction)
@@ -309,15 +315,15 @@ subroutine write_axis_metadata(this, fileobj, parent_axis)
end select
type is (FmsNetcdfUnstructuredDomainFile_t)
select case (diag_axis%type_of_domain)
case (NO_DOMAIN)
!< Here the fileobj is in the unstructured domain, but the axis is not
!< Unstructured domain fileobjs can have axis that are not domain decomposed (i.e "Z" axis)
call register_axis(fileobj, axis_name, axis_length)
call register_field(fileobj, axis_name, diag_axis%type_of_data, (/axis_name/))
case (UG_DOMAIN)
!< Here the axis is in a unstructured domain
call register_axis(fileobj, axis_name)
call register_field(fileobj, axis_name, diag_axis%type_of_data, (/axis_name/))
case default
!< Here the fileobj is in the unstructured domain, but the axis is not
!< Unstructured domain fileobjs can have axis that are not domain decomposed (i.e "Z" axis)
call register_axis(fileobj, axis_name, axis_length)
call register_field(fileobj, axis_name, diag_axis%type_of_data, (/axis_name/))
end select
end select

@@ -383,6 +389,44 @@ subroutine write_axis_data(this, fileobj, parent_axis)
end select
end subroutine write_axis_data

!< @brief Determine if the axis is in the unstructured grid
!! @return .True. if the axis is in unstructured grid
pure logical function is_unstructured_grid(this)
class(fmsDiagAxis_type), target, INTENT(in) :: this !< diag_axis obj

is_unstructured_grid = .false.
select type (this)
type is (fmsDiagFullAxis_type)
is_unstructured_grid = trim(this%cart_name) .eq. "U"
end select
end function is_unstructured_grid

!< @brief Adds the structured axis ids to the axis object
subroutine add_structured_axis_ids(this, axis_ids)
class(fmsDiagAxis_type), target, INTENT(inout) :: this !< diag_axis obj
integer, intent(in) :: axis_ids(2) !< axis ids to add to the axis object

select type (this)
type is (fmsDiagFullAxis_type)
allocate(this%structured_ids(2))
this%structured_ids = axis_ids
end select
end subroutine add_structured_axis_ids

!< @brief Get the structured axis ids from the axis object
!! @return the structured axis ids
pure function get_structured_axis(this) &
result(rslt)
class(fmsDiagAxis_type), target, INTENT(in) :: this !< diag_axis obj
integer :: rslt(2)

rslt = diag_null
select type (this)
type is (fmsDiagFullAxis_type)
rslt = this%structured_ids
end select
end function get_structured_axis

!> @brief Get the starting and ending indices of the global io domain of the axis
subroutine get_global_io_domain(this, global_io_index)
class(fmsDiagFullAxis_type), intent(in) :: this !< diag_axis obj
@@ -972,6 +1016,48 @@ pure function get_subaxes_id(this) &

end function

!< @brief Parses the "compress" attribute to get the names of the two axis
!! @return the names of the structured axis
pure function parse_compress_att(compress_att) &
result(axis_names)
class(*), intent(in) :: compress_att(:) !< The compress attribute to parse
character(len=120) :: axis_names(2)

integer :: ios !< Errorcode after parsing the compress attribute

select type (compress_att)
type is (character(len=*))
read(compress_att(1),*, iostat=ios) axis_names
if (ios .ne. 0) axis_names = ""
class default
axis_names = ""
end select
end function parse_compress_att

!< @brief Determine the axis id of a axis
!! @return Axis id
pure function get_axis_id_from_name(axis_name, diag_axis, naxis) &
result(axis_id)
class(fmsDiagAxisContainer_type), intent(in) :: diag_axis(:) !< Array of axis object
character(len=*), intent(in) :: axis_name !< Name of the axis
integer, intent(in) :: naxis !< Number of axis that have been registered
integer :: axis_id

integer :: i !< For do loops

axis_id = diag_null
do i = 1, naxis
select type(axis => diag_axis(i)%axis)
type is (fmsDiagFullAxis_type)
if (trim(axis%axis_name) .eq. trim(axis_name)) then
axis_id = i
return
endif
end select
enddo

end function get_axis_id_from_name

#endif
end module fms_diag_axis_object_mod
!> @}
33 changes: 25 additions & 8 deletions diag_manager/fms_diag_file_object.F90
Original file line number Diff line number Diff line change
@@ -1118,24 +1118,33 @@ end subroutine increase_unlimited_dimension
!< @brief Writes the axis metadata for the file
subroutine write_axis_metadata(this, diag_axis)
class(fmsDiagFileContainer_type), intent(inout), target :: this !< The file object
class(fmsDiagAxisContainer_type), intent(in) :: diag_axis(:) !< Diag_axis object
class(fmsDiagAxisContainer_type), intent(in), target :: diag_axis(:) !< Diag_axis object

class(fmsDiagFile_type), pointer :: diag_file !< Diag_file object to open
class(FmsNetcdfFile_t), pointer :: fileobj !< The fileobj to write to
integer :: i !< For do loops
integer :: j !< diag_file%axis_ids(i) (for less typing)
integer :: i,k !< For do loops
integer :: parent_axis_id !< Id of the parent_axis
integer :: structured_ids(2) !< Ids of the uncompress axis

class(fmsDiagAxisContainer_type), pointer :: axis_ptr !< pointer to the axis object currently writing

diag_file => this%FMS_diag_file
fileobj => diag_file%fileobj

do i = 1, diag_file%number_of_axis
j = diag_file%axis_ids(i)
parent_axis_id = diag_axis(j)%axis%get_parent_axis_id()
axis_ptr => diag_axis(diag_file%axis_ids(i))
parent_axis_id = axis_ptr%axis%get_parent_axis_id()
if (parent_axis_id .eq. DIAG_NULL) then
call diag_axis(j)%axis%write_axis_metadata(fileobj)
call axis_ptr%axis%write_axis_metadata(fileobj)
else
call diag_axis(j)%axis%write_axis_metadata(fileobj, diag_axis(parent_axis_id)%axis)
call axis_ptr%axis%write_axis_metadata(fileobj, diag_axis(parent_axis_id)%axis)
endif

if (axis_ptr%axis%is_unstructured_grid()) then
structured_ids = axis_ptr%axis%get_structured_axis()
do k = 1, size(structured_ids)
call diag_axis(structured_ids(k))%axis%write_axis_metadata(fileobj)
enddo
endif
enddo

@@ -1188,9 +1197,10 @@ subroutine write_axis_data(this, diag_axis)

class(fmsDiagFile_type), pointer :: diag_file !< Diag_file object to open
class(FmsNetcdfFile_t), pointer :: fileobj !< The fileobj to write to
integer :: i !< For do loops
integer :: i, k !< For do loops
integer :: j !< diag_file%axis_ids(i) (for less typing)
integer :: parent_axis_id !< Id of the parent_axis
integer :: structured_ids(2) !< Ids of the uncompress axis

diag_file => this%FMS_diag_file
fileobj => diag_file%fileobj
@@ -1203,6 +1213,13 @@ subroutine write_axis_data(this, diag_axis)
else
call diag_axis(j)%axis%write_axis_data(fileobj, diag_axis(parent_axis_id)%axis)
endif

if (diag_axis(j)%axis%is_unstructured_grid()) then
structured_ids = diag_axis(j)%axis%get_structured_axis()
do k = 1, size(structured_ids)
call diag_axis(structured_ids(k))%axis%write_axis_data(fileobj)
enddo
endif
enddo

end subroutine write_axis_data
30 changes: 27 additions & 3 deletions diag_manager/fms_diag_object.F90
Original file line number Diff line number Diff line change
@@ -30,7 +30,8 @@ module fms_diag_object_mod
& get_diag_files_id, diag_yaml
use fms_diag_axis_object_mod, only: fms_diag_axis_object_init, fmsDiagAxis_type, fmsDiagSubAxis_type, &
&diagDomain_t, get_domain_and_domain_type, diagDomain2d_t, &
&fmsDiagAxisContainer_type, fms_diag_axis_object_end, fmsDiagFullAxis_type
&fmsDiagAxisContainer_type, fms_diag_axis_object_end, fmsDiagFullAxis_type, &
&parse_compress_att, get_axis_id_from_name
use fms_diag_buffer_mod
#endif
#if defined(_OPENMP)
@@ -373,7 +374,7 @@ end function fms_register_static_field
!> @brief Wrapper for the register_diag_axis subroutine. This is needed to keep the diag_axis_init
!! interface the same
!> @return Axis id
FUNCTION fms_diag_axis_init(this, axis_name, axis_data, units, cart_name, long_name, direction,&
FUNCTION fms_diag_axis_init(this, axis_name, axis_data, units, cart_name, axis_length, long_name, direction,&
& set_name, edges, Domain, Domain2, DomainU, aux, req, tile_count, domain_position ) &
& result(id)

@@ -382,6 +383,7 @@ FUNCTION fms_diag_axis_init(this, axis_name, axis_data, units, cart_name, long_n
CLASS(*), INTENT(in) :: axis_data(:) !< Array of coordinate values
CHARACTER(len=*), INTENT(in) :: units !< Units for the axis
CHARACTER(len=1), INTENT(in) :: cart_name !< Cartesian axis ("X", "Y", "Z", "T", "U", "N")
integer, intent(in) :: axis_length !< The length of the axis size(axis_data(:))
CHARACTER(len=*), INTENT(in), OPTIONAL :: long_name !< Long name for the axis.
CHARACTER(len=*), INTENT(in), OPTIONAL :: set_name !< Name of the parent axis, if it is a subaxis
INTEGER, INTENT(in), OPTIONAL :: direction !< Indicates the direction of the axis
@@ -423,7 +425,7 @@ FUNCTION fms_diag_axis_init(this, axis_name, axis_data, units, cart_name, long_n
endif
call axis%register(axis_name, axis_data, units, cart_name, long_name=long_name, &
& direction=direction, set_name=set_name, Domain=Domain, Domain2=Domain2, DomainU=DomainU, aux=aux, &
& req=req, tile_count=tile_count, domain_position=domain_position)
& req=req, tile_count=tile_count, domain_position=domain_position, axis_length=axis_length)

id = this%registered_axis
call axis%set_axis_id(id)
@@ -629,6 +631,9 @@ subroutine fms_diag_axis_add_attribute(this, axis_id, att_name, att_value)
character(len=*), intent(in) :: att_name !< Name of the attribute
class(*), intent(in) :: att_value(:) !< The attribute value to add

character(len=20) :: axis_names(2) !< Names of the uncompress axis
integer :: uncmx_ids(2) !< Ids of the uncompress axis
integer :: j !< For do loops
#ifndef use_yaml
CALL MPP_ERROR(FATAL,"You can not use the modern diag manager without compiling with -Duse_yaml")
#else
@@ -638,6 +643,25 @@ subroutine fms_diag_axis_add_attribute(this, axis_id, att_name, att_value)
select type (axis => this%diag_axis(axis_id)%axis)
type is (fmsDiagFullAxis_type)
call axis%add_axis_attribute(att_name, att_value)

!! Axis that are in the "unstructured" domain require a "compress" attribute for the
!! combiner and PP. This attribute is passed in via a diag_axis_add_attribute call in the model code
!! The compress attribute indicates the names of the axis that were compressed
!! For example grid_index:compress = "grid_yt grid_xt"
!! The metadata and the data for these axis also needs to be written to the file
if (trim(att_name) .eq. "compress") then
!< If the attribute is the "compress" attribute, get the axis names,
!! and the ids of the axis and add it to the axis object so it can be written to netcdf files
!! that use this axis
axis_names = parse_compress_att(att_value)
do j = 1, size(axis_names)
uncmx_ids(j) = get_axis_id_from_name(axis_names(j), this%diag_axis, this%registered_axis)
if (uncmx_ids(j) .eq. diag_null) call mpp_error(FATAL, &
&"Error parsing the compress attribute for axis: "//trim(axis%get_axis_name())//&
&". Be sure that the axes in the compress attribute are registered")
enddo
call axis%add_structured_axis_ids(uncmx_ids)
endif
end select
#endif
end subroutine fms_diag_axis_add_attribute
3 changes: 2 additions & 1 deletion test_fms/diag_manager/test_modern_diag.F90
Original file line number Diff line number Diff line change
@@ -109,11 +109,12 @@ program test_modern_diag
set_name="land", DomainU=land_domain, aux="geolon_t geolat_t")

id_z = diag_axis_init('z', z, 'point_Z', 'z', long_name='point_Z')
!TODO call diag_axis_add_attribute (id_z, 'formula', 'p(n,k,j,i) = ap(k) + b(k)*ps(n,j,i)')
call diag_axis_add_attribute (id_z, 'formula', 'p(n,k,j,i) = ap(k) + b(k)*ps(n,j,i)')
call diag_axis_add_attribute (id_z, 'integer', 10)
call diag_axis_add_attribute (id_z, '1d integer', (/10, 10/))
call diag_axis_add_attribute (id_z, 'real', 10.)
call diag_axis_add_attribute (id_x, '1d real', (/10./))
call diag_axis_add_attribute (id_ug, 'compress', 'x y')

if (id_x .ne. 1) call mpp_error(FATAL, "The x axis does not have the expected id")
if (id_y .ne. 2) call mpp_error(FATAL, "The y axis does not have the expected id")