forked from ESCOMP/CTSM
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add readme expert_only and new sites
- Loading branch information
1 parent
ebb2432
commit 88e5e7e
Showing
5 changed files
with
425 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,74 @@ | ||
To be added soon. | ||
$CTSMROOT/README_fates_emerald_api_expert_only 03/06/2020 | ||
|
||
################################################################################# | ||
# This document explains how to update the model codes and | ||
# how to create atmospheric forcing and inputdata for new sites | ||
# (No technical support will be promised, use at your own risk!) | ||
# See also Yeliz's notes: https://ctsm-docs.readthedocs.io/en/latest/ for additional details | ||
################################################################################# | ||
|
||
######## Two important things to watch out first!!! | ||
######## Two important things to watch out first!!! | ||
######## Two important things to watch out first!!! | ||
(1) Module environment on your supercomputer: DON'T load any module beforehand, except "StdEvn"! | ||
(2) Git version control: | ||
CLM-FATES have very complex and sperate repository system: | ||
-> ctsm: always create your own branch, do not touch master! | ||
-> cime: remember to create your own branch in cime folder also, to record all the changes you make. | ||
-> fates: remember to create your own branch in fates folder also, to record all the changes you make. | ||
If you do not create your own branch for "cime" and "fates", when you run "./manage_externals/checkout_externals", your previous "cime" and "fates" will be overwritten. | ||
|
||
|
||
######## Download ctsm and update ctsm-fates (Only important steps are illustrated here!!!) | ||
**** If you are already using fates_emerald_api, skip this! **** | ||
e.g.: | ||
git remote add ctsm_ncar https://github.com/ESCOMP/CTSM.git # set a remote name for NCAR CTSM git repository | ||
git fetch ctsm_ncar # get the most recent updates of CTSM | ||
git merge ctsm_ncar/master # update your current branch with the newest CTSM version | ||
git merge ctsm_ncar/fates_next_api # update your current branch with the newest CLM-FATES interface | ||
|
||
##To update fates, you need to go to fates folder | ||
e.g.: | ||
git remote add NGEET_fates https://github.com/NGEET/fates.git | ||
git fetch NGEET_fates # get the most recent updates of FATES | ||
git merge NGEET_fates.git/master # update your current branch with the newest FATES | ||
|
||
######## Adapt ctsm/cime to specific machine (e.g., SAGA and FRAM) | ||
**** If you are already using fates_emerald_api, skip this! **** | ||
Following file need to be modified | ||
..../cime/config/cesm/machines/config_batch.xml | ||
..../cime/config/cesm/machines/config_compilers.xml | ||
..../cime/config/cesm/machines/config_machines.xml | ||
|
||
See example here, you need look for the setup | ||
https://github.com/NordicESMhub/cime/blob/cime5.6.10_noresm2_1_rel_06/config/cesm/machines/config_compilers.xml | ||
https://github.com/NordicESMhub/cime/blob/cime5.6.10_noresm2_1_rel_06/config/cesm/machines/config_machines.xml | ||
https://github.com/NordicESMhub/cime/blob/cime5.6.10_noresm2_1_rel_06/config/cesm/machines/config_batch.xml | ||
|
||
|
||
**** If you want to set up new sites, please follow the following steps **** | ||
######## Make script grids (see "prepare_inputdata.sh" in ./tools) | ||
######## Make domain file (see "prepare_inputdata.sh" in ./tools) | ||
######## Make mapping file (see "prepare_inputdata.sh" in ./tools) | ||
######## Make surface data file (see "prepare_inputdata.sh" in ./tools) | ||
######## Make and modify FATES parameter file: | ||
## Use existing tools: | ||
./src/fates/tools/FatesPFTIndexSwapper.py # Select PFTs interested. | ||
./src/fates/tools/modify_fates_paramfile.py # Modify PFT parameters | ||
## To use these tools, netcdf and python modules need to be loaded. | ||
module load netCDF-Fortran/4.4.4-intel-2018b | ||
module load Python/3.6.6-intel-2018b | ||
./FatesPFTIndexSwapper.py --pft-indices=2,6,9,10 --fin=****.nc --fout=****.nc | ||
## The default FATES parameter file is in ./src/fates/parameter_files | ||
## To create a netcdf parameter file: ncgen -o ****.nc fates_params_default.cdl | ||
######## Make atmospheric forcing for new sites (see "prepare_atm_forcing_****.ncl" in ./tools) | ||
|
||
######## Set each sites as a unique grid type. The following file need to be modified: | ||
~/ctsm/cime/config/cesm/config_grids.xml | ||
~/ctsm/cime/src/components/data_comps/datm/cime_config/namelist_definition_datm.xml | ||
~/ctsm/bld/namelist_files/namelist_defaults_clm4_5.xml | ||
|
||
######## Set new atmospheric forcing for the sites | ||
~/ctsm/cime/src/components/data_comps/datm/cime_config/config_component.xml (for different climate forcing) | ||
~/ctsm/cime_config/config_component.xml (for different climate forcing) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,159 @@ | ||
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl" | ||
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/popRemap.ncl" | ||
load "$NCARG_ROOT/lib/ncarg/nclscripts/esmf/ESMF_regridding.ncl" | ||
load "$NCARG_ROOT/lib/ncarg/nclscripts/contrib/cd_string.ncl" | ||
|
||
begin | ||
|
||
;######### SeedClim Sites | ||
; plot_lat=(/61.0243,60.8231,60.8328,60.9335,60.8203,60.8760,61.0866,60.5445,61.0355,60.8803,60.6652,60.6901/) | ||
; plot_lon=(/8.12343,7.27596,7.17561,6.41504,8.70466,7.17666,6.63028,6.51468,9.07876,7.16982,6.33738,5.96487/) | ||
; plot_name=(/"ALP1","ALP2","ALP3","ALP4","SUB1","SUB2","SUB3","SUB4","BOR1","BOR2","BOR3","BOR4"/) | ||
|
||
;######### Landpress Sites | ||
; plot_lat=(/60.70084,65.83677,64.779,65.79602/) | ||
; plot_lon=(/5.092566,12.224506,11.2193,12.219299/) | ||
; plot_name=(/"LYG","BUO","HAV","SKO"/) | ||
|
||
;######### Three-D Sites | ||
plot_lat=(/60.88019,60.86183,60.85994/) | ||
plot_lon=(/7.16990,7.16800,7.19504/) | ||
plot_name=(/"VIKE","JOAS","LIAH"/) | ||
|
||
;######### Finnmark Site | ||
; plot_lat=(/69.341088/) | ||
; plot_lon=(/25.293524/) | ||
; plot_name=(/"FINN"/) | ||
|
||
mon = ispan(0,11,1) | ||
mon@units = "month" | ||
month =cd_string(mon,"%N") | ||
print(month) | ||
|
||
do p=0,2,1 | ||
clim_output = "/cluster/shared/noresm/inputdata/atm/datm7/fates_platform/"+plot_name(p)+"/" | ||
clim_input = "/cluster/shared/noresm/inputdata/atm/datm7/atm_forcing.datm7.GSWP3.0.5d.v1.c170516/" | ||
system("mkdir -p "+ clim_output) | ||
xfloor=plot_lon(p)-0.005 | ||
xceil =plot_lon(p)+0.005 | ||
yfloor=plot_lat(p)-0.005 | ||
yceil =plot_lat(p)+0.005 | ||
print(yceil) | ||
print(xceil) | ||
|
||
do year=1901,2010,1 | ||
do m=0,11,1 | ||
|
||
frsds=addfile(clim_input+"/Solar/clmforc.GSWP3.c2011.0.5x0.5.Solr."+year+"-"+month(m)+".nc","r") | ||
fprec=addfile(clim_input+"/Precip/clmforc.GSWP3.c2011.0.5x0.5.Prec."+year+"-"+month(m)+".nc","r") | ||
ftphw=addfile(clim_input+"/TPHWL/clmforc.GSWP3.c2011.0.5x0.5.TPQWL."+year+"-"+month(m)+".nc","r") | ||
|
||
rsds=frsds->FSDS(:,:,:) | ||
prec=fprec->PRECTmms(:,:,:) | ||
psrf=ftphw->PSRF(:,:,:) | ||
tbot=ftphw->TBOT(:,:,:) | ||
wind=ftphw->WIND(:,:,:) | ||
qbot=ftphw->QBOT(:,:,:) | ||
flds=ftphw->FLDS(:,:,:) | ||
|
||
lon=frsds->LONGXY(0,:) | ||
lat=frsds->LATIXY(:,0) | ||
time=frsds->time(:) | ||
edgew =frsds->EDGEW | ||
edgee =frsds->EDGEE | ||
edges =frsds->EDGES | ||
edgen =frsds->EDGEN | ||
longxy =frsds->LONGXY | ||
latixy =frsds->LATIXY | ||
|
||
loni=ind_nearest_coord(plot_lon(p), lon, 0) | ||
latj=ind_nearest_coord(plot_lat(p), lat, 0) | ||
print(loni) | ||
print(latj) | ||
|
||
;########## Creat forcing in netcdf format | ||
|
||
system("rm -f "+clim_output+"clm1pt_"+plot_name(p)+"_"+year+"-"+month(m)+".nc") ; remove if exists | ||
fclim = addfile(clim_output+"clm1pt_"+plot_name(p)+"_"+year+"-"+month(m)+".nc","c") | ||
ntim = dimsizes(time) ; get dimension sizes | ||
nlat = 1 | ||
nlon = 1 | ||
nscalar = 1 | ||
|
||
setfileoption(fclim,"DefineMode",True) | ||
|
||
fAtt = True ; assign file attributes | ||
fAtt@case_title = "GSWP3v1: norway " | ||
fAtt@conventions = "CF-1.0" | ||
fAtt@title = "CLM single point datm input data" | ||
fAtt@history = "Original data from GSWP3v1 data" | ||
fAtt@creation_date = systemfunc ("date") | ||
fileattdef( fclim, fAtt ) ; copy file attributes | ||
|
||
dimNames = (/"scalar","lon","lat","time"/) | ||
dimSizes = (/ nscalar, nlon, nlat, -1 /) | ||
dimUnlim = (/ False, False, False, True/) | ||
filedimdef(fclim,dimNames,dimSizes,dimUnlim) | ||
|
||
filevardef(fclim, "EDGEW" ,typeof(edgew),getvardims(edgew)) | ||
filevardef(fclim, "EDGEE" ,typeof(edgee),getvardims(edgee)) | ||
filevardef(fclim, "EDGES" ,typeof(edges),getvardims(edges)) | ||
filevardef(fclim, "EDGEN" ,typeof(edgen),getvardims(edgen)) | ||
filevardef(fclim, "LONGXY" ,typeof(longxy) ,getvardims(longxy)) | ||
filevardef(fclim, "LATIXY" ,typeof(latixy) ,getvardims(latixy)) | ||
filevardef(fclim, "time",typeof(time),getvardims(time)) | ||
filevardef(fclim, "FSDS",typeof(rsds),getvardims(rsds)) | ||
filevardef(fclim, "PRECTmms",typeof(prec),getvardims(prec)) | ||
filevardef(fclim, "TBOT",typeof(tbot),getvardims(tbot)) | ||
filevardef(fclim, "WIND",typeof(wind),getvardims(wind)) | ||
filevardef(fclim, "PSRF",typeof(psrf),getvardims(psrf)) | ||
filevardef(fclim, "QBOT",typeof(qbot),getvardims(qbot)) | ||
filevardef(fclim, "FLDS",typeof(flds),getvardims(flds)) | ||
|
||
filevarattdef(fclim,"EDGEW",edgew) | ||
filevarattdef(fclim,"EDGEE",edgee) | ||
filevarattdef(fclim,"EDGES",edges) | ||
filevarattdef(fclim,"EDGEN",edgen) | ||
filevarattdef(fclim,"LONGXY",longxy) | ||
filevarattdef(fclim,"LATIXY",latixy) | ||
filevarattdef(fclim,"time",time) | ||
filevarattdef(fclim,"FSDS",rsds) | ||
filevarattdef(fclim,"PRECTmms",prec) | ||
filevarattdef(fclim,"TBOT",tbot) | ||
filevarattdef(fclim,"WIND",wind) | ||
filevarattdef(fclim,"PSRF",psrf) | ||
filevarattdef(fclim,"QBOT",qbot) | ||
filevarattdef(fclim,"FLDS",flds) | ||
|
||
setfileoption(fclim,"DefineMode",False) | ||
|
||
print(time) | ||
fclim->time = (/time/) ; "(/", "/)" syntax tells NCL to only output the data values to the predefined locations on the file. | ||
fclim->EDGEW = (/xfloor/) | ||
fclim->EDGEE = (/xceil/) | ||
fclim->EDGES = (/yfloor/) | ||
fclim->EDGEN = (/yceil/) | ||
fclim->LONGXY = (/plot_lon(p)/) | ||
fclim->LATIXY = (/plot_lat(p)/) | ||
fclim->FSDS = (/rsds(:,latj,loni)/) | ||
fclim->PRECTmms = (/prec(:,latj,loni)/) ; !!!! time variable can be modified in the attributes of the variable is also copied. make sure to use (/ /) to only copy data. | ||
fclim->TBOT = (/tbot(:,latj,loni)/) | ||
fclim->WIND = (/wind(:,latj,loni)/) | ||
fclim->PSRF = (/psrf(:,latj,loni)/) | ||
fclim->QBOT = (/qbot(:,latj,loni)/) | ||
fclim->FLDS = (/flds(:,latj,loni)/) | ||
|
||
delete(time) | ||
delete(rsds) | ||
delete(prec) | ||
delete(tbot) | ||
delete(qbot) | ||
delete(wind) | ||
delete(psrf) | ||
delete(flds) | ||
|
||
end do | ||
end do | ||
end do | ||
end | ||
|
Oops, something went wrong.