Skip to content

Commit

Permalink
Merge pull request #4 from billsacks/nc_via_lfs
Browse files Browse the repository at this point in the history
Store netCDF files via Git LFS
  • Loading branch information
slevis-lmwg authored Dec 4, 2021
2 parents 0fa98b2 + 5958cc7 commit 93da10f
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 2 deletions.
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@
*.jpeg filter=lfs diff=lfs merge=lfs -text
*.gif filter=lfs diff=lfs merge=lfs -text
*.pdf filter=lfs diff=lfs merge=lfs -text
*.nc filter=lfs diff=lfs merge=lfs -text
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,10 @@ manage_externals.log
**/.svn/**
.svn/

# binary files
# netcdf files
*.nc
# but don't ignore netcdf files here:
!/python/ctsm/test/testinputs/*.nc

# editor files
*.swp
Expand Down
7 changes: 6 additions & 1 deletion .lfsconfig
Original file line number Diff line number Diff line change
@@ -1,2 +1,7 @@
[lfs]
fetchexclude = *
# We auto-fetch any netCDF files, because they are needed for
# running tests; however, we do NOT auto-fetch other binary
# files, in particular image files that are part of the
# documentation source (these are fetched as part of the
# documentation build process).
fetchinclude = *.nc
35 changes: 35 additions & 0 deletions python/ctsm/test/testinputs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
Any netCDF files in this directory (and elsewhere in the repository) should be
stored via Git LFS (Large File Support). To retrieve any netCDF files, or to add
or modify any netCDF files, you will need to install the Git LFS tool.

Installing Git LFS on your machine is a two-step process; step (1) needs to be
done once per machine, and step (2) needs to be done once per user:
1. Install the Git LFS tool: Follow the instructions on the [Git LFS
page](https://git-lfs.github.com/) for installing Git LFS on your platform.
- On cheyenne, Git LFS is already available as long as you are using a git
module rather than the default system-level git. So just make sure that you
are always using git via a git module (`module load git`).
- On a Mac using homebrew, this can be done with `brew install git-lfs`.
2. Set up your git configuration to use Git LFS by running: `git lfs install`
(this will add a few lines to your `.gitconfig` file in your home directory).
(If you're not sure whether you have already done this, it is safe to rerun
that command to be sure.)

If any netCDF file appears to be a text file like this:

```
version https://git-lfs.github.com/spec/v1
oid sha256:df03c76138bbdcdd12497a4bb0a86591283d1d8ef90cba80d823660f549381c0
size 896
```

then that is a sign that you may not have Git LFS installed. You can first try
running "git lfs pull". If that doesn't work, then install Git LFS as documented
above.

For more information on using Git LFS with CTSM, search for lfs here:
<https://github.com/ESCOMP/CTSM/wiki/Directions-for-editing-CLM-documentation-on-github-and-sphinx>.
Most of the notes about using Git LFS for the documentation's image files apply
here as well, although (in contrast to image files) netCDF files *are* pulled
down by default, so you usually should *not* need to explicitly run `git lfs
pull` to get new or updated netCDF files.

0 comments on commit 93da10f

Please sign in to comment.