Giter VIP home page Giter VIP logo

mitgcm.jl's Introduction

MITgcm.jl

Documentation codecov CI

Binder DOI

Julia interface to MITgcm that allows user not only to analyze model output, but also to download the source code, build the model executable, modify run-time parameters, run model simulations, or verify model results against a benchmark.

Notebooks and tutorials are found in the docs.

Examples / How-To

To open a notebook using Pluto.jl:

  1. open julia in terminal window
  2. type command below at the Julia prompt
  3. new web browser tab should show Pluto prompt
  4. copy/paste a notebook URL from the docs
cd("examples/"); using Pluto; Pluto.run()
Examples / Running Models
Examples / Analyzing Results

mitgcm.jl's People

Contributors

gaelforget avatar jbisits avatar juliatagbot avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

mitgcm.jl's Issues

Struggling to use `GridLoad_mnc` or `GridLoad_mdsio` with my configuration

This thread follows up on a question I received over email, which seems more useful to try address here in case others may have s similar issue.

Question was along the lines of:

"I went through the documentation of MITgcmTools.jl and MeshArrays.jl before asking, but I still can’t figure this out; the notebooks don’t really show how to load a setup that was not run using the julia wrapper setup.

Specifically, I am trying to figure out how to create a gcmgrid from a netcdf grid file (of files). The GridLoad_mnc function from MITgcmTools.jl needs either a gcmgrid as input or a MITgcm_config, which is created when running the MITgcm using your tools."

[JOSS Review] Minor comments

Hello! I've gone through the examples and such, and really only have minor comments.

The first is that HS94_Makie.jl didn't run for me. I get the error message

ArgumentError: No file exists at given path: /var/folders/7h/kw60pdp92yv7z_x6hjb4b0mr0000gq/T/HS94_animation_link/run/HS94.jld2

when trying to run the Pluto notebook

The second, and really minor, is that in the documentation when looking through "Functionalities" a couple functions are listed as ClimateModels.function where they should be MITgcm.function, if that make sense. These are specifically the functions build, clean, compile, and setup.

Aside from those I didn't run into issues running the code/examples given. I have some thoughts on the documentation itself, but don't feel that this should prevent the paper from being published so maybe take the remainder as "potential considerations for future versions of the documentation" :)

I really like MITgcm_workflow.jl and HS94_animation.jl, since they both provide a good walkthrough of how to run specific model configurations and read the output. I do think that it would be helpful though to provide a bit more info on what's going on.

For example, in MITgcm_workflow.jl when we get to analyzing results the user is shown a list of (what I think are all) outputs from running the configuration, in my case this was tutorial_global_oce_biogeo. However what the variables are is sort of vague, I don't really know what's contained in something like "surfDiag.0005184004.001.002.data" and it could be useful to have a reference point on what exactly I'm looking at/what the MITgcm returns to the user. I'm guessing that this is all documented in the MITgcm documentation itself, so maybe providing a link to the relevant location?

Going to HS94_animation.jl, I have a somewhat similar comment. In the block on Workflow Steps, we're shown sort of three things. First we setup the directory, then compile, and then how to modify parameters. Setting up the directory and compiling the model is fine since this is, I'm guessing, fairly uniform across the different configurations, but the tunable parameters likely change between model configurations. It could be helpful to describe to the user what options they have, so again just a link to the MITgcm documentation and/or providing an explanation here. It’s also still not overly clear to me how one goes about changing parameters. In this example I can piece together what was done, but for example in the line

fil1=joinpath(PICKUP_hs94_path,"pickup.0000043200.data”)

I don’t know where the path PICKUP_hs94_path came from, or how we knew that this is how to adjust the initial state.

I guess in summary, providing information on the MITgcm and what capabilities it has, especially considering there will be people who come to use MITgcm.jl who (like me) have never used the MITgcm before. So reading pickups and building models are all sort of foreign concepts when you’re used to Julia ocean models. As a bit of a side note, it would also be really cool if there was an example that demonstrated the adjoint capabilities the MITgcm (ECCO?) has. I’m guessing this would be computationally expensive, but still really neat to see in Julia.

Redefinition of `fileIn` causes data to not be read in using `read_nctiles` with ECCOv4r4 data files

Thanks for the great package!

I have been trying to read in data from ECCOv4r4 using MITgcmTools on the llc90 grid (there is a mwe below) and the code would run but I kept getting a gcmarray returned that was populated with NaNs. The downloaded files from ECCOv4r4 that I initially tried this for was UVELMASS_1992_01.nc downloaded from the ECCO drive and the same granule (OCEAN_3D_VOLUME_FLUX_mon_mean_1992-01_ECCO_V4r4_native_llc0090.nc) from the NASA granule listing.

I think there is a redefinition of the variable fileIn in line 172 of ReadFiles.jl causing the gcmarray to be populated with NaNs

f0=fill(NaN,mygrid.fSize[ff]...,s[3:end]...)
n0=m0[1]
for n in 1:nn
  fileIn=@sprintf("%s.%04d.nc",fileRoot,n+n0) # redefinition that means isfile(fileIn) = false
  if isfile(fileIn) #skip if no file / blank tile
    x = ClimateModels.ncread(fileIn,fldName,start,count)
        ...

When I run

julia> isfile(@sprintf("%s", fileIn))
true

but

julia> isfile(@sprintf("%s.%04d.nc",fileRoot,1))
false

so the condition to enter the loop to read the data is never satisfied.
I forked this repo and removed the redefinition of fileIn and this solved my issue. I have opened a draft PR with this fix, but this might not skip if there is no file or blank tile?

MWE

Using the ECCO-GRID.nc file from the ECCO drive to try and reproduce the demonstration in the docs

Before fix

julia> using MITgcmTools, MeshArrays
julia> mygrid = GridSpec("LatLonCap")
julia> fileName = #path to data on my machine
julia> Depth = read_nctiles(fileName, "Depth", mygrid)
5×13 MeshArrays.gcmarray{Float64, 2, Matrix{Float64}}:
 [NaN NaN  NaN NaN; NaN NaN  NaN NaN;  ; NaN NaN  NaN NaN; NaN NaN  NaN NaN]    [NaN NaN  NaN NaN; NaN NaN  NaN NaN;  ; NaN NaN  NaN NaN; NaN NaN  NaN NaN]
 [NaN NaN  NaN NaN; NaN NaN  NaN NaN;  ; NaN NaN  NaN NaN; NaN NaN  NaN NaN]     [NaN NaN  NaN NaN; NaN NaN  NaN NaN;  ; NaN NaN  NaN NaN; NaN NaN  NaN NaN]
 [NaN NaN  NaN NaN; NaN NaN  NaN NaN;  ; NaN NaN  NaN NaN; NaN NaN  NaN NaN]     [NaN NaN  NaN NaN; NaN NaN  NaN NaN;  ; NaN NaN  NaN NaN; NaN NaN  NaN NaN]
 [NaN NaN  NaN NaN; NaN NaN  NaN NaN;  ; NaN NaN  NaN NaN; NaN NaN  NaN NaN]     [NaN NaN  NaN NaN; NaN NaN  NaN NaN;  ; NaN NaN  NaN NaN; NaN NaN  NaN NaN]
 [NaN NaN  NaN NaN; NaN NaN  NaN NaN;  ; NaN NaN  NaN NaN; NaN NaN  NaN NaN]     [NaN NaN  NaN NaN; NaN NaN  NaN NaN;  ; NaN NaN  NaN NaN; NaN NaN  NaN NaN]

After fix

julia> Depth = read_nctiles(fileName, "Depth", mygrid)
5×13 MeshArrays.gcmarray{Float64, 2, Matrix{Float64}}:
 [0.0 0.0  3125.52 3203.08; 0.0 0.0  2908.5 3283.12;  ; 0.0 0.0  5383.54 5433.77; 0.0 0.0  5332.44 5367.77]    [3920.27 3984.9  2949.7 3076.34; 3809.59 3906.7  3126.5 3119.12;  ; 0.0 0.0  0.0 0.0; 0.0 0.0  0.0 0.0]
 [0.0 0.0  3125.52 3203.08; 0.0 0.0  2908.5 3283.12;  ; 0.0 0.0  5383.54 5433.77; 0.0 0.0  5332.44 5367.77]     [3920.27 3984.9  2949.7 3076.34; 3809.59 3906.7  3126.5 3119.12;  ; 0.0 0.0  0.0 0.0; 0.0 0.0  0.0 0.0]
 [0.0 0.0  3125.52 3203.08; 0.0 0.0  2908.5 3283.12;  ; 0.0 0.0  5383.54 5433.77; 0.0 0.0  5332.44 5367.77]     [3920.27 3984.9  2949.7 3076.34; 3809.59 3906.7  3126.5 3119.12;  ; 0.0 0.0  0.0 0.0; 0.0 0.0  0.0 0.0]
 [0.0 0.0  3125.52 3203.08; 0.0 0.0  2908.5 3283.12;  ; 0.0 0.0  5383.54 5433.77; 0.0 0.0  5332.44 5367.77]     [3920.27 3984.9  2949.7 3076.34; 3809.59 3906.7  3126.5 3119.12;  ; 0.0 0.0  0.0 0.0; 0.0 0.0  0.0 0.0]
 [0.0 0.0  3125.52 3203.08; 0.0 0.0  2908.5 3283.12;  ; 0.0 0.0  5383.54 5433.77; 0.0 0.0  5332.44 5367.77]     [3920.27 3984.9  2949.7 3076.34; 3809.59 3906.7  3126.5 3119.12;  ; 0.0 0.0  0.0 0.0; 0.0 0.0  0.0 0.0]

[JOSS Review] Repository

  1. I was able to run the example provided in https://gaelforget.github.io/MITgcm.jl/dev/examples/ on a Linux computer but not on my Mac M1. After some investigation, most likely it was a problem with the optfile for Apple silicon that was recently changed (probably after MITgcm/MITgcm#613). Eventually, I was able to run the advect_xy configuration by specifying a NETCDF_ROOT directory. However, the error message was not instructive so it was difficult to assess the problem. I would suggest more verbose error messages such that the user can diagnose what is wrong (or even report the error through an issue on this repo)
  2. A couple of bugs in the MITgcm_scan_output.jl example:
  • When selecting the ECCO grid the error is UndefVarError: Point2 not defined
  • When selecting the verification grid I get type Missing has no field params_files (I think it refers to the variable sc)
  1. MITgcm.jl_run example: the only case that runs is the advect_xy, all the other configurations fail to build with the error model compilation may have failed
  2. MITgcm_workflow.jl` example:
  • The advect_xy configuration runs and shows a visualization of the results.
  • The other cases fail with the error message KeyError: key :setup not found
  1. I have problems with building other examples such as HS94_animation.jl
  2. Given that most of the examples do not work on my laptop, I think it might be a configuration issue from my side. Providing a non-pluto example that produces a headless visualization (such as with CairoMakie) would help me test the repo on a remote linux machine.
  3. as written in #105 (and given point 7.) I would add an example that runs in the terminal (for non-GUI people like myself) so that it is not necessary to open Pluto which requires a graphical user interface

TagBot trigger issue

This issue is used to trigger TagBot; feel free to unsubscribe.

If you haven't already, you should update your TagBot.yml to include issue comment triggers.
Please see this post on Discourse for instructions and more details.

features that would seem useful to add or improve

  • use DataDeps for code and data inputs
  • better handling of environment variables (switch to withenv, ...)
    • MITGCM_ROOTDIR, DATADEPS_ALWAYS_ACCEPT
    • NETCDF_ROOT, MPI_INC_DIR
  • method to cutout subdomain from a global grid, and generate inputs for OBCS
  • passive tracer example with interactive choice of injection site
  • workflow that repeats forcing, starting from final checkpoint
  • profiles package handling (input, output, interpolation coeffs)
  • ecco package handling (cost function, generic terms)
  • adjoint examples (gradient check, reconstruction)
  • preparation of initial conditions for e.g. llc90 and cs32
  • preparation of forcing field on e.g. llc90 and cs32
  • pkg/darwin+radtrans example
  • plot method for MITgcm_config (verification exps to start)
  • summary view across stdout, and interactive access to items in it
  • more detailed and explicit feedback from system_check
    • especially wrt undocumented features like NETCDF_ROOT and SKIP_NETCDF_CHECK (genmake2 sometimes returns error in relation to these)
    • maybe point user to this issue and other relevant issues

[JOSS Review] Documentation

As for the paper, it is written and descriptive. I have a couple of comments

  • The first mention of MITgcm.jl is in the MITgcm File Formats section using MITgcm_tutorial_global_oce_biogeo.jl. However, this notebook is not found in the examples. I believe it would be better to showcase an example from the repository, like the one shown below with MITgcm_scan_output.jl.
  • While it is nice to have notebooks, I think it would be beneficial to include an example that runs in the terminal.
  • (Maybe a lot of work so not strictly necessary) At the moment the only literated example in the docs runs a simulation but does not show any visual output. Adding a visualization (using Plots or CairoMakie) to the examples in the documentation would greatly help non-MITgcm users (does not have to be a prognostic field, it could also be just the grid visualized on a sphere).

[JOSS Review] The software paper

@gaelforget the paper is well-written, I have just a minor comment on figure 2 which I believe is not very descriptive of the user interface. Would it be possible to show the interface that actually runs (or builds) the model instead of the description of what the notebook does?

Reading MITgcm output

Hi Gael,

I added MITgcmTools in Julia and tried to use "read_mdsio" to read in a normal MITgcm output file.

data=read_mdsio("U.0006307200.data")

However, I got the following error message:

ERROR: UndefVarError: read_mdsio not defined

I did add using MITgcmTools at the very beginning so I was wondering what was wrong. Does the script only read in output that is generated with ClimateModels?

Thanks!

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.