Git Product home page Git Product logo

Comments (9)

christophernhill avatar christophernhill commented on August 28, 2024 3

from climatemachine.jl.

tapios avatar tapios commented on August 28, 2024

I'm in favor of flattening. CamelCase generally is also fine with me. But constructs such as CLIMAAtmosDycore are hard to read. Underscores or hyphens would help here.

from climatemachine.jl.

glwagner avatar glwagner commented on August 28, 2024

Even just Atmos might be sufficiently descriptive and memorable.

from climatemachine.jl.

tapios avatar tapios commented on August 28, 2024

@jkozdon Some more thoughts on this:

  1. Directory hierarchy is useful where it reflects logical hierarchy. I propose we leave, e.g., Atmos/Dycore, Atmos/Parameterizations etc. Otherwise the root where Atmos lives will get very unwieldy soon (many model components, each with their own hierarchy...)

  2. If we want to use Camel Case for directories, let's omit the CLIMA in front of Atmos etc.

  3. Camel Case for modules and structs is also fine, for consistency with Julia.

  4. But underscores in function and variable names increase readability, and I favor retaining those.

from climatemachine.jl.

charleskawczynski avatar charleskawczynski commented on August 28, 2024

This all sounds good to me. Maybe we can move the coding conventions document into CLIMA somewhere and update it using these ideas?

from climatemachine.jl.

jkozdon avatar jkozdon commented on August 28, 2024

re: @tapios

I suppose my default recommendation is that we start with the Julia style guide recommendations, and then specify deviations from that.

  1. Within Julia we can create submodules as well. So the unwieldiness could be managed there, if it made sense to one have a few core modules, say AtmosDycore and AtmosParameterizations
  2. Sounds good to me
  3. Sounds good
  4. This is the Julia style guide as well.

From [style-guide]:(https://docs.julialang.org/en/v1/manual/style-guide/index.html#Use-naming-conventions-consistent-with-Julia-base/-1)

  • modules and type names use capitalization and camel case: module SparseArrays, struct UnitRange.
  • functions are lowercase (maximum, convert) and, when readable, with multiple words squashed together (isequal, haskey). When necessary, use underscores as word separators. Underscores are also used to indicate a combination of concepts (remotecall_fetch as a more efficient implementation of fetch(remotecall(...))) or as modifiers.
  • conciseness is valued, but avoid abbreviation (indexin rather than indxin) as it becomes difficult to remember whether and how particular words are abbreviated.

from climatemachine.jl.

tapios avatar tapios commented on August 28, 2024

Thanks, @jkozdon. Following Julia style where it makes sense sounds good to me. Regarding directory structure, while I am in favor of flattening unnecessary hierarchy, I am not convinced we should flatten so much as to put AtmosDycore and Atmos etc. into one root. Several reasons:

  1. Our code will be complex in the end, more comparable, say, to an OS kernel than to most Julia projects. Some structure will help (as it does, say, in the Linux kernel).

  2. With the proposed convention, we would end up with complicated constructs such as AtmosParameterizationsRadiationRRTMG. I would find it helpful to have directory structure for it, rather than loading the names with the structure.

  3. We will need some code in other languages, e.g., for radiation. Again, easier to drop it into a directory for radiation..

  4. The atmosphere, ocean, land etc. models should work as standalone models in the end. It's easier to identify what one needs for these models if there is a directory tree for each of them, and directory trees for shared code.

That being said, I'm not sure we need hierarchies like Parameterizations/src (but if there is a good reason for having that, I can be convinced otherwise).

from climatemachine.jl.

jkozdon avatar jkozdon commented on August 28, 2024

I suppose the bigger issue than directory structure, is packages vs modules vs files.

Packages have to have the own src/ directory as well as a Project.toml and (most of the time) Manifest.toml. We can have modules within packages too, but these need not have their own src/ directory.

Naively, it seems to me that pieces we imagine being spun off at standalone components should be packages, and these need to be uniquely named.

One option would be that Atmos is a package, with Dycore, Parameterizations, etc. as a submodule. To use these you would then type using Atmos.Dycore or using Atmos.Parameterization in the code.

Another option would be the AtmosDycore and AtmosParameterization are the packages, with possible submodules.

Packages we can version, whereas modules we cannot.

We also have the possibility of just dropping everything in files and using the include mechanism everywhere, but this will cause problems with the namespace.

from climatemachine.jl.

tapios avatar tapios commented on August 28, 2024

@jkozdon All good points. I think you guys can make this structural decision, given that we need a standalone atmosphere model (both in global and LES configurations, which may differ slightly in terms of SGS models), and other standalone models. We will also want to use, e.g, various parameterizations in offline (single-column) mode, but I suppose that can be done whether they are packages or modules.

from climatemachine.jl.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.