forked from ibanos90/obs2ioda
-
Notifications
You must be signed in to change notification settings - Fork 6
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
Adding pFUnit Support for Unit Testing in obs2ioda #23
Closed
Closed
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
8305903
Added pFUnit as an optional dependency for building and writing unit …
amstokely aa27d68
Updated the find libbufr command in the ncep bufr install section.
amstokely 2a70c05
Udated installation section of README.
amstokely c38a9ec
Fixed typo in install instructions
amstokely fb39e55
Updated readme links in root README to point to NCAR org repo obs2iod…
amstokely 2b62978
Updated pfunit install instructions in readme.
amstokely 5dd1690
Readded example test.
amstokely b4f8a9c
Improved clarity of install instructions in README.
amstokely 4849bfe
Deleted example test.
amstokely bd42980
Added c string interpol type so that you can easily pass strings and …
amstokely 4212a73
Added blank cmake lists file to test/fortran so that obs2ioda compiles.
amstokely c3f0bba
Deleted f_c_string_t modules.
amstokely 92d1bdb
Changed minimum cmake version to 3.12
amstokely File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,46 +3,65 @@ | |
obs2ioda-v2 utilizes CMake as its primary build system. Follow the steps below to build the project: | ||
|
||
### Prerequisites | ||
Please make sure the following libraries are installed: | ||
- NetCDF | ||
- NCEP BUFR library. (Instructions for installing the NCEP BUFR library are provided in a subsequent section) | ||
|
||
If you have an environment preconfigured for `mpas-jedi`, simply source that environment prior to building `obs2ioda`. | ||
Prior to building `obs2ioda`, ensure that you have installed the following libraries: | ||
|
||
- **CMake**: Required (version 3.20 or higher). | ||
- **NetCDF**: Required. | ||
- **NCEP BUFR Library**: Required. | ||
- **pFUnit**: Optional (Needed for testing). | ||
|
||
For instructions on how to install `pFUnit` and the `NCEP BUFR` library , please refer to the respective sections: | ||
|
||
- [Installing NCEP BUFR Library](#installing-ncep-bufr-library) | ||
- [Installing pFUnit](#installing-pfunit) | ||
|
||
If you have an environment preconfigured for `mpas-jedi` or `mpas-bundle`, simply source that environment prior to building `obs2ioda`. | ||
|
||
### Build Instructions | ||
1. First, clone the repository into your preferred directory (`<OBS2IODA_ROOT_DIR>`): | ||
```bash | ||
git clone https://github.com/NCAR/obs2ioda.git <OBS2IODA_ROOT_DIR> | ||
``` | ||
2. Create a new directory `build` and navigate into it: | ||
```bash | ||
mkdir build && cd build | ||
``` | ||
3. Locate the NCEP BUFR library by executing the following command in the `NCEP BUFR` library's build directory: | ||
1. Create a new directory `<OBS2IODA_BUILD_DIR>` and navigate into it: | ||
```bash | ||
find . -name *libbufr* | ||
mkdir <OBS2IODA_BUILD_DIR> && cd <OBS2IODA_BUILD_DIR> | ||
``` | ||
4. Next, run CMake to configure the build. Specify the `CMAKE_BUILD_TYPE` option to set the build type. Currently, the supported types are `Release`, `RelWithDebInfo`, and `Debug`. Don't forget to include the path to the NCEP BUFR library: | ||
1. Set the variable OBS2IODA_CMAKE_ARGS to include the `obs2ioda` root directory and the absolute path of the `NCEP BUFR` library: | ||
```bash | ||
OBS2IODA_CMAKE_ARGS="<OBS2IODA_ROOT_DIR> -DNCEP_BUFR_LIB=<NCEP_BUFR_LIB_PATH>" | ||
amstokely marked this conversation as resolved.
Show resolved
Hide resolved
|
||
``` | ||
1. If building in `Debug` mode, append the following to `OBS2IODA_CMAKE_ARGS`: | ||
```bash | ||
OBS2IODA_CMAKE_ARGS="${OBS2IODA_CMAKE_ARGS} -DCMAKE_BUILD_TYPE=Debug" | ||
``` | ||
1. If building unit tests, append the following to `OBS2IODA_CMAKE_ARGS`: | ||
```bash | ||
OBS2IODA_CMAKE_ARGS="${OBS2IODA_CMAKE_ARGS} -DBUILD_TESTS=ON -DPFUNIT_DIR=<PFUNIT_DIR>" | ||
``` | ||
where `<PFUNIT_DIR>` is the directory of the `pFUnit` installation. | ||
|
||
1. Next, run CMake to configure the build. | ||
```bash | ||
cmake <OBS2IODA_ROOT_DIR> -DNCEP_BUFR_LIB=<NCEP_BUFR_LIB_PATH> -DCMAKE_BUILD_TYPE=<BUILD_TYPE> | ||
cmake <OBS2IODA_ROOT_DIR> 'echo ${OBS2IODA_CMAKE_ARGS}' | ||
``` | ||
5. Finally, build `obs2ioda` using `CMake`'s build tool. In this case, we use `GNU Make`, but other build tools supported by `CMake` can be used: | ||
1. Finally, build `obs2ioda` using `CMake`'s build tool. In this case, we use `GNU Make`, but other build tools supported by `CMake` can be used: | ||
```bash | ||
make | ||
``` | ||
The `obs2ioda-v2` executable will reside in the `bin` directory within the build directory. | ||
|
||
--- | ||
## Installing NCEP BUFR Library | ||
### Installing NCEP BUFR Library | ||
To install the NCEP BUFR library, follow these steps: | ||
|
||
1. Clone the NCEP BUFR repository into a directory of your choice (`<NCEP_BUFR_ROOT_DIR>`): | ||
```bash | ||
git clone https://github.com/NOAA-EMC/NCEPLIBS-bufr.git <NCEP_BUFR_ROOT_DIR> | ||
``` | ||
2. Create a new directory `build` and navigate into it: | ||
2. Create a new directory `<NCEP_BUFR_BUILD_DIR>` and navigate into it: | ||
```bash | ||
mkdir build && cd build | ||
mkdir <NCEP_BUFR_BUILD_DIR> && cd <NCEP_BUFR_BUILD_DIR> | ||
``` | ||
3. Run CMake to configure the build (Ensure NetCDF is installed): | ||
```bash | ||
|
@@ -54,9 +73,34 @@ To install the NCEP BUFR library, follow these steps: | |
``` | ||
5. To locate the NCEP BUFR library, run: | ||
```bash | ||
find . -name *libbufr* | ||
bash -c "find . -name *libbufr*" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is there a specific reason this |
||
``` | ||
Remember to note down the library path (`<NCEP_BUFR_LIB_PATH>`) required for the build process of `obs2ioda-v2`. | ||
|
||
--- | ||
|
||
### Installing pFUnit | ||
|
||
To install `pFUnit` version 4.10.0, follow these steps: | ||
|
||
1. Clone the `pFUnit` repository into your desired directory (`<PFUNIT_ROOT_DIR>`): | ||
```bash | ||
git clone https://github.com/Goddard-Fortran-Ecosystem/pFUnit.git -b v4.10.0 <PFUNIT_ROOT_DIR> | ||
``` | ||
|
||
2. Navigate to the `pFUnit` directory: | ||
```bash | ||
cd <PFUNIT_ROOT_DIR> | ||
``` | ||
Follow the instructions for building version 4.10.0 with `CMake`, provided on the [pFUnit GitHub page](https://github.com/Goddard-Fortran-Ecosystem/pFUnit?tab=readme-ov-file#building-and-installing-pfunit). | ||
|
||
**Note:** If you do not intend to use this installation of `pFUnit` for testing `MPI` or `OpenMP` libraries, pass the following options to `CMake` during the build process: | ||
```bash | ||
-DUSE_MPI=OFF -DUSE_OPENMP=OFF | ||
``` | ||
|
||
amstokely marked this conversation as resolved.
Show resolved
Hide resolved
|
||
--- | ||
|
||
## caveate | ||
NetCDF-Fortran interface does not allow reading/writing NF90_STRING, so ``station_id`` and ``variable_names`` are still written out as | ||
``char station_id(nlocs, nstring)`` | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/fortran) |
Empty file.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this should now read
3.12
.