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

Resolves #269. Any variable that was named pos is now named domain_position #270

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ sequential patch number (starting from `01`).

## [Unreleased]
### Added
- Calls to register_diag_axis using an X or Y axis that is shifted from the `CENTER` position need to include the optional argument `domain_position` and should be equal to `EAST` or `NORTH` based on the position relative to the domain. `EAST` and `NORTH` are exposed through `diag_manager_mod`.
### Changed
### Deprecated
### Removed
Expand Down
21 changes: 11 additions & 10 deletions diag_manager/diag_axis.F90
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ MODULE diag_axis_mod
& get_tile_count, get_axes_shift, get_diag_axis_name,&
& get_axis_num, get_diag_axis_domain_name, diag_axis_add_attribute,&
& get_domainUG, axis_compatible_check, axis_is_compressed, &
& get_compressed_axes_ids, get_axis_reqfld
& get_compressed_axes_ids, get_axis_reqfld, &
& NORTH, EAST, CENTER

! Module variables
! Parameters
Expand Down Expand Up @@ -154,7 +155,7 @@ MODULE diag_axis_mod
! </IN>
! <IN NAME="tile_count" TYPE="INTEGER, OPTIONAL" />
INTEGER FUNCTION diag_axis_init(name, DATA, units, cart_name, long_name, direction,&
& set_name, edges, Domain, Domain2, DomainU, aux, req, tile_count, pos)
& set_name, edges, Domain, Domain2, DomainU, aux, req, tile_count, domain_position )
CHARACTER(len=*), INTENT(in) :: name
REAL, DIMENSION(:), INTENT(in) :: DATA
CHARACTER(len=*), INTENT(in) :: units
Expand All @@ -166,7 +167,7 @@ INTEGER FUNCTION diag_axis_init(name, DATA, units, cart_name, long_name, directi
TYPE(domainUG), INTENT(in), OPTIONAL :: DomainU
CHARACTER(len=*), INTENT(in), OPTIONAL :: aux, req
INTEGER, INTENT(in), OPTIONAL :: tile_count
INTEGER, INTENT(in), OPTIONAL :: pos
INTEGER, INTENT(in), OPTIONAL :: domain_position


TYPE(domain1d) :: domain_x, domain_y
Expand Down Expand Up @@ -299,15 +300,15 @@ INTEGER FUNCTION diag_axis_init(name, DATA, units, cart_name, long_name, directi
ELSE
Axes(diag_axis_init)%req = 'none'
END IF
IF ( PRESENT(pos) ) THEN
if (pos == NORTH .or. pos == EAST .or. pos == CENTER) then
Axes(diag_axis_init)%pos = pos
IF ( PRESENT(domain_position) ) THEN
if (domain_position == NORTH .or. domain_position == EAST .or. domain_position == CENTER) then
Axes(diag_axis_init)%domain_position = domain_position
else
CALL error_mesg('diag_axis_mod::diag_axis_init', "Position must be NORTH, EAST, or CENTER" ,&
FATAL)
endif
ELSE
Axes(diag_axis_init)%pos = CENTER
Axes(diag_axis_init)%domain_position = CENTER
END IF

!---- axis direction (-1, 0, or +1) ----
Expand Down Expand Up @@ -536,7 +537,7 @@ END FUNCTION diag_subaxes_init
! Array of coordinate values for this axis.
! </OUT>
SUBROUTINE get_diag_axis(id, name, units, long_name, cart_name,&
& direction, edges, Domain, DomainU, DATA, num_attributes, attributes, pos)
& direction, edges, Domain, DomainU, DATA, num_attributes, attributes, domain_position)
CHARACTER(len=*), INTENT(out) :: name, units, long_name, cart_name
INTEGER, INTENT(in) :: id
TYPE(domain1d), INTENT(out) :: Domain
Expand All @@ -545,7 +546,7 @@ SUBROUTINE get_diag_axis(id, name, units, long_name, cart_name,&
REAL, DIMENSION(:), INTENT(out) :: DATA
INTEGER, INTENT(out), OPTIONAL :: num_attributes
TYPE(diag_atttype), ALLOCATABLE, DIMENSION(:), INTENT(out), OPTIONAL :: attributes
INTEGER, INTENT(out), OPTIONAL :: pos
INTEGER, INTENT(out), OPTIONAL :: domain_position

INTEGER :: i, j, istat

Expand All @@ -558,7 +559,7 @@ SUBROUTINE get_diag_axis(id, name, units, long_name, cart_name,&
edges = Axes(id)%edges
Domain = Axes(id)%Domain
DomainU = Axes(id)%DomainUG
if (present(pos)) pos = Axes(id)%pos
if (present(domain_position)) domain_position = Axes(id)%domain_position
IF ( Axes(id)%length > SIZE(DATA(:)) ) THEN
! <ERROR STATUS="FATAL">array data is too small.</ERROR>
CALL error_mesg('diag_axis_mod::get_diag_axis', 'array data is too small', FATAL)
Expand Down
2 changes: 1 addition & 1 deletion diag_manager/diag_data.F90
Original file line number Diff line number Diff line change
Expand Up @@ -622,7 +622,7 @@ MODULE diag_data_mod
INTEGER :: tile_count
TYPE(diag_atttype), _ALLOCATABLE, dimension(:) :: attributes _NULL
INTEGER :: num_attributes
INTEGER :: pos !< The position in the doman (NORTH or EAST or CENTER)
INTEGER :: domain_position !< The position in the doman (NORTH or EAST or CENTER)
END TYPE diag_axis_type
! </TYPE>

Expand Down
3 changes: 2 additions & 1 deletion diag_manager/diag_manager.F90
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ MODULE diag_manager_mod
& file_exist, fms_error_handler, check_nml_error, get_mosaic_tile_file, lowercase
USE fms_io_mod, ONLY: get_instance_filename
USE diag_axis_mod, ONLY: diag_axis_init, get_axis_length, get_axis_num, get_domain2d, get_tile_count,&
& diag_axis_add_attribute, axis_compatible_check
& diag_axis_add_attribute, axis_compatible_check, CENTER, NORTH, EAST
USE diag_util_mod, ONLY: get_subfield_size, log_diag_field_info, update_bounds,&
& check_out_of_bounds, check_bounds_are_exact_dynamic, check_bounds_are_exact_static,&
& diag_time_inc, find_input_field, init_input_field, init_output_field,&
Expand Down Expand Up @@ -255,6 +255,7 @@ MODULE diag_manager_mod
& DIAG_MINUTES, DIAG_HOURS, DIAG_DAYS, DIAG_MONTHS, DIAG_YEARS, get_diag_global_att,&
& set_diag_global_att, diag_field_add_attribute, diag_field_add_cell_measures,&
& get_diag_field_id, diag_axis_add_attribute
PUBLIC :: CENTER, NORTH, EAST !< Used for diag_axis_init
! Public interfaces from diag_grid_mod
PUBLIC :: diag_grid_init, diag_grid_end
PUBLIC :: diag_manager_set_time_end, diag_send_complete
Expand Down
2 changes: 1 addition & 1 deletion diag_manager/diag_output.F90
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,7 @@ SUBROUTINE write_axis_meta_data(file_unit, axes, fileob, time_ops, time_axis_reg

CALL get_diag_axis(id_axis, axis_name, axis_units, axis_long_name,&
& axis_cart_name, axis_direction, axis_edges, Domain, DomainU, axis_data,&
& num_attributes, attributes, pos=axis_pos)
& num_attributes, attributes, domain_position=axis_pos)

IF ( Domain .NE. null_domain1d ) THEN
IF ( length > 0 ) THEN
Expand Down