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

multi file data override yaml #3

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
7 changes: 7 additions & 0 deletions data_override/README.MD
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,13 @@ If it is desired to interpolate the data to a region of the model grid. The foll
- **lat_start:** The starting longitude in the same units as the grid data in the file
- **lon_end:** The ending longitude in the same units as the grid data in the file

If it is desired to use multiple(3) input netcdf files instead of 1. The following **optional** keys are available.
- **is_multi_file:** Set to `True` is using the multi-file feature
- **prev_file_name:** The name of the first file in the set
- **next_file_name:** The name of the third file in the set

Note that **file_name** must be the second file in the set. **prev_file_name** and/or **next_file_name** are required if **is_multi_file** is set to `True`

#### 2. How to use it?
In order to use the yaml data format, [libyaml](https://github.com/yaml/libyaml) needs to be installed and linked with FMS. Additionally, FMS must be compiled with -Duse_yaml macro. If using autotools, you can add `--with-yaml`, which will add the macro for you and check that libyaml is linked correctly.
```
Expand Down
17 changes: 17 additions & 0 deletions data_override/include/data_override.inc
Original file line number Diff line number Diff line change
Expand Up @@ -576,6 +576,23 @@ subroutine read_table_yaml(data_table)
call get_value_from_key(file_id, entry_id(i), "fieldname_file", data_table(i)%fieldname_file, &
& is_optional=.true.)

data_table(i)%multifile = .false.
call get_value_from_key(file_id, entry_id(i), "is_multi_file", data_table(i)%multifile, &
& is_optional=.true.)

if (data_table(i)%multifile) then
data_table(i)%prev_file_name = ""
data_table(i)%next_file_name = ""
call get_value_from_key(file_id, entry_id(i), "prev_file_name", data_table(i)%prev_file_name, &
& is_optional=.true.)
call get_value_from_key(file_id, entry_id(i), "next_file_name", data_table(i)%next_file_name, &
& is_optional=.true.)
if (trim(data_table(i)%prev_file_name) .eq. "" .and. trim(data_table(i)%next_file_name) .eq. "") &
call mpp_error(FATAL, "The prev_file_name and next_file_name must be present if is_multi_file. "//&
"Check your data_table.yaml entry for field:"//trim(data_table(i)%gridname)//":"//&
trim(data_table(i)%fieldname_code))
endif

data_table(i)%file_name = ""
call get_value_from_key(file_id, entry_id(i), "file_name", data_table(i)%file_name, &
& is_optional=.true.)
Expand Down
Loading