Skip to content

nbharwani11/CIRES-Interview

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

34 Commits
 
 
 
 
 
 

Repository files navigation

NOAA-GSL

Coding Challenge

Instructions: Given the two sample namelist fortran files in this repo, please write a Python based tool that gives a user a command line interface that takes file paths as input and provides a report on the differences between the two files as output. For context, Fortran doesn't care about section/key order, so it's often difficult for users to track down differences in values that two researchers may have prepared independently.

Getting Started with f90nml (A Python module for Fortran namelists)

The latest documentation for f90nml can be found at https://f90nml.readthedocs.io/en/latest/

Installation

$ pip install f90nml

Set Up

Clone the repository

$ git clone https://github.com/nbharwani11/NOAA-GSL.git

Executing the Code

Once you have cloned the repository and have installed f90nml perform the following operations:

$ cd src
$ python compare_nml_files.py insert_filepath_nml_1 insert_filepath_nml_2

or

$ ./compare_nml_files.py insert_filepath_nml_1 insert_filepath_nml_2

Running pytest

I mainly followed the tutorial listed here

Following their guidelines perform the operations below:

$ mkdir pytest_project
$ cd pytest_project
$ python3 -m venv pytest-env
$ source pytest-env/bin/activate
$ pip install pytest

Now execute the pytest command $ pytest to run the tests

  • Be sure to follow the styling guidelines in the link provided (i.e. Pytest expects our tests to be located in files whose names begin with test_ or end with _test.py)

Sources

Below are my sources that I used to complete the coding challenge

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages