Skip to content

Rosie's developer instructions

Rosie Fisher edited this page Apr 26, 2024 · 27 revisions

These instructions are basic setup instructions for doing FATES development in the context of CTSM.

  1. Clone CTSM
> git clone https://github.com/ESCOMP/ctsm.git
> cd ctsm

2. Check out external pieces of code, including FATES. 
> ./manage_externals/checkout_externals
  1. Go into sandbox
cd cime/scripts
  1. Make a test case with vanilla clm5 to check sandbox
./create_newcase --case ctsm_test_case --res f45_f45_mg37 --compset I2000Clm50BgcCrop --run-unsupported
cd ctsm_test_case
./case.setup
./case.build
./xmlchange --id STOP_N --val 10
./xmlchange --id RUN_STARTDATE --val '1996-01-01'
./xmlchange --id STOP_OPTION --val nyears
./xmlchange --id CLM_FORCE_COLDSTART --val on
./xmlchange --id JOB_WALLCLOCK_TIME --val 06:00:00
./xmlchange --id DATM_YR_START --val 1996
./xmlchange --id DATM_YR_END --val 2001
./case.submit
  1. Make a FATES test case with to check sandbox FATES version
./create_newcase --case clm5-fates_test_case --res f45_f45_mg37 --compset I2000Clm50Fates --run-unsupported
cd clm5-fates_test_case
./case.setup
./case.build
./xmlchange --id STOP_N --val 10
./xmlchange --id RUN_STARTDATE --val '2001-01-01'
./xmlchange --id STOP_OPTION --val nyears
./xmlchange --id CLM_FORCE_COLDSTART --val on
./xmlchange --id JOB_WALLCLOCK_TIME --val 06:00:00
./xmlchange --id DATM_YR_START --val 1996
./xmlchange --id DATM_YR_END --val 2001
./case.submit
  1. Go to FATES code:
cd ../../../src/fates/
  1. Check we are in the fates-release repo.
git remote -v
  1. Add FATES development repo:
git remote add ngeet_repo https://github.com/NGEET/fates.git
  1. Make your own fork of FATES In a web browser, go to https://github.com/NGEET/FATES and press 'fork'

This should now be in https://github.com/rosiealice/fates/ (obviously, change 'rosiealice' for your own username on github)

Add this repo to your remotes (back in terminal)

git remote add rosie_fates_repo  https://github.com/rosiealice/fates
  1. Synchronize "master" branch with the NGEET/repository

> git fetch ngeet_repo
> git checkout master
> git pull ngeet_repo master
  1. Create and switch to new feature branch, e.g.
git checkout -b deeproots

note on how to work with an existing branch.. https://www.atlassian.com/git/tutorials/syncing/git-fetch

  1. Make another FATES test case with to double check branch FATES version
cd ../cime/scripts/
./create_newcase --case clm5-fates_test_case_2 --res f45_f45_mg37 --compset I2000Clm50Fates --run-unsupported
cd clm5-fates_test_case_2
./case.setup
./case.build
./xmlchange STOP_N=10
./xmlchange STOP_OPTION=nyears
./xmlchange CLM_FORCE_COLDSTART=on
./xmlchange --id JOB_WALLCLOCK_TIME --val 06:00:00
./xmlchange --id DATM_CLMNCEP_YR_START --val 1996
./xmlchange --id DATM_CLMNCEP_YR_END --val 2001
./case.submit
  1. Modify code.

  2. Make new case to test modifications:

./create_newcase --case clm5-fates_btranmod --res f45_f45_mg37 --compset I2000Clm50Fates
cd clm5-fates_test_case_2
./case.setup
./case.build
./xmlchange STOP_N=10
./xmlchange STOP_OPTION=nyears
./xmlchange CLM_FORCE_COLDSTART=on
./case.submit
  1. Commit modifications to branch:
git add biogeophys/EDBtranMod.F90
git commit -m "btran modifications for deep water access"
  1. Check for new updates on NGEET/FATES
git pull ngeet_repo master
  1. Go back to feature branch
git checkout deeproots
  1. Merge changes back into branch in from ngeet_repo via master branch.
git merge master
  1. Push committed changes back onto fork
git push rosie_fates_repo deeproots
  1. Go look at https://github.com/rosiealice/fates/branches to check that all is well.

  2. Make pull request using web interface as per https://github.com/NGEET/fates/wiki/Commit-and-Pull-Request-Protocols

IF YOU GET STUCK IN DETACHED HEAD STATE, USE git reset TO GO BACK TO EARLIER COMMIT.

Clone this wiki locally