csdms / babelizer

Transform BMI-wrapped models into Python packages
https://babelizer.readthedocs.io
MIT License
4 stars 3 forks source link

Add a C++ example to the documentation #105

Open mdpiper opened 3 months ago

mdpiper commented 3 months ago

This PR adds a long-form C++ example to the documentation, similar to the existing C and Fortran examples.

This fixes #101.

mdpiper commented 3 months ago

View the example in the docs at: https://babelizer.readthedocs.io/en/mdpiper-add-cxx-example/example-cxx.html.

mcflugen commented 3 months ago

In reading over all of the examples, there is a lot of duplication between the languages. Each example is divided into three parts:

  1. Build an example library
  2. Run the babelizer on that library
  3. Add metadata so that it can be used in pymt

I wonder if we can simplify this.

Building a BMI library seems like it is outside the scope of the babelizer. Instead of describing how to do this, could we either point to the instructions for each example or use an example library that can be installed via conda?

Since the pymt stuff is the same for each language can we have just one page that shows how to do this and then point to that page from each of the examples? This step is also optional and a little beyond the scope of the babelizer. Maybe that could be made more clear?

mdpiper commented 3 months ago

In reading over all of the examples, there is a lot of duplication between the languages.

I agree, and you're correct--it would be good to simplify. However, I'm OK with duplication here because most people will care only about one language, and I want a complete, end-to-end, example for each. Full disclosure: the first few times I tried this workflow (model -> BMI -> babelizer -> pymt), I was confused until I made an end-to-end example. I'm hoping my experience can help inform others.

aufdenkampe commented 2 months ago

@mdpiper, I got this example to work on a Mac, using the global environment file at https://github.com/LimnoTech/babelizer-examples/blob/main/environment.yml.

I'll now circle back to try to get it to run on Windows, which didn't work the first time I tried. I'll share updates.