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

Data override: ext weights #1534

Closed

Conversation

abrooks1085
Copy link
Contributor

@abrooks1085 abrooks1085 commented May 22, 2024

Description
Subroutine to read new data table yaml format has been updated. Data override test scripts have been updated for new yaml format as well as the data override documentation.

Fixes #1521

How Has This Been Tested?
built on amd box using autotools with gcc/13.2.0, netcdf/4.9.2, mpich/4.1.2, libyaml/0.2.5

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • Any dependent changes have been merged and published in downstream modules
  • New check tests, if applicable, are included
  • make distcheck passes

@abrooks1085 abrooks1085 changed the title Data override: ext weights #1521 Data override: ext weights May 22, 2024
```
Which corresponds to the following model code:
```F90
call data_override('ICE', 'sic_obs', icec, Spec_Time)
```
where:
- `ICE` corresponds to the gridname in the data_table
- `sic_obs` corresponds to the fieldname_code in the data_table
- `ICE` corresponds to the grid_name in the data_table
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's the component domain for which the variable is being interpolated

- `ICE` corresponds to the gridname in the data_table
- `sic_obs` corresponds to the fieldname_code in the data_table
- `ICE` corresponds to the grid_name in the data_table
- `sic_obs` corresponds to the fieldname_in_model in the data_table
- `icec` is the variable to write the data to
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't that the storage array that holds the interpolated data?

Comment on lines 101 to 104
- `ICE` corresponds to the grid_name in the data_table
- `sit_obs` corresponds to the fieldname_in_model in the data_table
- `icec` is the variable to write the data to
- `Spec_Time` is the time to interpolate the data to.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See comments above.

Comment on lines 136 to 139
- `OCN` corresponds to the grid_name in the data_table
- `runoff` corresponds to the fieldname_in_model in the data_table
- `runoff_data` is the variable to write the data to
- `Spec_Time` is the time to interpolate the data to.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See comments above

Copy link
Contributor

@uramirez8707 uramirez8707 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just some minor changes.

call check_for_valid_gridname(data_table(i)%gridname)
call get_value_from_key(file_id, entry_id(i), "fieldname_code", data_table(i)%fieldname_code)
call get_value_from_key(file_id, entry_id(i), "fieldname_in_model", data_table(i)%fieldname_code)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should move the call that gets the factor here

call get_value_from_key(file_id, entry_id(i), "fieldname_code", data_table(i)%fieldname_code)
call get_value_from_key(file_id, entry_id(i), "fieldname_in_model", data_table(i)%fieldname_code)

mentries = get_num_blocks(file_id, "override_file", parent_block_id=entry_id(i))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you should add something like

! initialize the data_override type
data_table(i)%file_name = ""
data_table(i)%fieldname_file = ""
data_table(i)%interpol_method = "none"
data_table(i)%multifile = .false.
data_table(i)%ext_weights = .false.
data_table(i)%region_type = NO_REGION

! If there is no override_file block, then not overriding from file, so move on to the next entry
if (mentries .eq. 0) cycle

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and remove in the lines below

Comment on lines +597 to +598
call get_value_from_key(file_id, sub_block_id(1), "file_name", data_table(i)%file_name, &
& is_optional=.true.)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is_optional should be removed now, because you are overriding from a file so the file_name is required

Comment on lines +601 to +602
call get_value_from_key(file_id, sub_block_id(1), "fieldname_in_file", data_table(i)%fieldname_file, &
& is_optional=.true.)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is_optional should be removed now, because you are overriding from a file so the fieldname_in_file is required

Comment on lines +605 to +606
call get_value_from_key(file_id, sub_block_id(1), "interp_method", data_table(i)%interpol_method, &
& is_optional=.true.)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is_optional should be removed now, because you are overriding from a file so the interpol_method is required

- **file_name:** Name of the file where the variable is located, including the directory
- **fieldname_in_file:** Name of the field as it is writen in the file
- **interp_method:** Method used to interpolate the field. The acceptable values are "bilinear", "bicubic", and "none". "none" implies that the field in the file is already in the model grid. The LIMA format is no longer supported
- **multi_file:** The multifile parent key. **Required** only if it is desired to use multiple(3) input netcdf files instead of 1. Note that **file_name** must be the second file in the set when using multiple input netcdf files
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add an example using that uses multi_file and external_weights?

@uramirez8707 uramirez8707 mentioned this pull request Jul 22, 2024
8 tasks
@rem1776
Copy link
Contributor

rem1776 commented Jul 23, 2024

closing since these commits will be included in the PR above

@rem1776 rem1776 closed this Jul 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Update the data_table yaml format
4 participants