From fbdc6f5071510c2ee2111a8d390992f82b8b2193 Mon Sep 17 00:00:00 2001 From: Max Stevens Date: Mon, 27 Jun 2022 12:54:41 -0700 Subject: [PATCH] updating to v.1.1.10 --- CFM_main/RCMpkl_to_spin.py | 7 +++++-- CFM_main/firn_density_nospin.py | 10 +++++----- CFM_main/main.py | 2 +- CFM_main/strain.py | 1 + changelog.md | 15 ++++++++++++++- docs/running/outputs.rst | 9 ++++++++- 6 files changed, 34 insertions(+), 10 deletions(-) diff --git a/CFM_main/RCMpkl_to_spin.py b/CFM_main/RCMpkl_to_spin.py index 0e3046a..6495841 100644 --- a/CFM_main/RCMpkl_to_spin.py +++ b/CFM_main/RCMpkl_to_spin.py @@ -169,7 +169,10 @@ def makeSpinFiles(CLIM_name,timeres='1D',Tinterp='mean',spin_date_st = 1980.0, s stepsperyear = 1/(df_CLIM_re.decdate.diff().mean()) - BDOT_mean_IE = ((df_CLIM_re['BDOT']+df_CLIM_re['SUBLIM'])*stepsperyear/917).mean() + if 'SUBLIM' in df_CLIM_re: + BDOT_mean_IE = ((df_CLIM_re['BDOT']+df_CLIM_re['SUBLIM'])*stepsperyear/917).mean() + else: + BDOT_mean_IE = ((df_CLIM_re['BDOT'])*stepsperyear/917).mean() T_mean = (df_TS_re['TSKIN']).mean() print(BDOT_mean_IE) print(T_mean) @@ -186,7 +189,7 @@ def makeSpinFiles(CLIM_name,timeres='1D',Tinterp='mean',spin_date_st = 1980.0, s depth_S2 = desired_depth * 0.75 #### Make spin up series ### RCI_length = spin_date_end-spin_date_st+1 - num_reps = int(np.round(desired_depth/BDOT_mean_IE/RCI_length)) + num_reps = int(np.round(desired_depth/BDOT_mean_IE/RCI_length)) years = num_reps*RCI_length sub = np.arange(-1*years,0,RCI_length) startyear = int(df_CLIM_re.index[0].year + sub[0]) diff --git a/CFM_main/firn_density_nospin.py b/CFM_main/firn_density_nospin.py index 74dba1d..6a17ae5 100644 --- a/CFM_main/firn_density_nospin.py +++ b/CFM_main/firn_density_nospin.py @@ -445,13 +445,13 @@ def __init__(self, configName, climateTS = None, NewSpin = False): self.iceout = self.c['iceout'] print('Ensure that your iceout value has units m ice eq. per year!') else: - self.iceout = np.mean(self.bdot) # this is the rate of ice flow advecting out of the column, units m I.E. per year. + self.iceout = np.mean(self.bdot+self.sublim) # this is the rate of ice flow advecting out of the column, units m I.E. per year. except Exception: print('add field "manual_iceout" to .json file to set iceout value manually') self.iceout = np.mean(self.bdot) # this is the rate of ice flow advecting out of the column, units m I.E. per year. - self.w_firn = np.mean(self.bdot) * RHO_I / self.rho + self.w_firn = np.mean(self.bdot+self.sublim) * RHO_I / self.rho if (np.any(self.bdotSec<0.0) and self.c['bdot_type']=='instant'): print('ERROR: bdot_type set to "instant" in .json and input') @@ -570,14 +570,14 @@ def __init__(self, configName, climateTS = None, NewSpin = False): self.Trunoff = np.array([0.]) #total runoff, single value for the whole firn column self.refrozen = np.zeros_like(self.dz) #vrefreezing in every layer, array of size of our grid self.totalrunoff = np.array([0.]) # Might be useful to have a total final value without having to write every time step - self.totalrefrozen = np.zeros_like(self.dz) # Might be useful to have a total final value without having to write every time step - self.totwatersublim = 0. #VV Total amount of liquid water that get sublimated + self.totalrefrozen = np.zeros_like(self.dz) # Might be useful to have a total final value without having to write every time step self.lwcerror = 0. #VV self.totallwcerror = 0. # #VV update (23/03/2021) self.refreeze = np.array([0.]) #total liquid water refreezing at each time step [m we] self.runoff = np.array([0.]) #total liquid water runoff at each time step [m we] self.meltvol = np.array([0.]) #total melt volume + self.totwatersublim = 0. #VV Total amount of liquid water that get sublimated ### Strain modules self.c = check_strain_settings(self) @@ -822,7 +822,7 @@ def time_evolve(self): print('modeltime',self.modeltime[0],self.modeltime[-1]) for iii in range(self.stp): mtime = self.modeltime[iii] - self.D_surf[iii] = iii + self.D_surf[iii] = iii # This gives each layer a tracking number that is just iteration number. if iii==1000: if ((self.MELT) and (self.c['liquid']=='darcy')): pass diff --git a/CFM_main/main.py b/CFM_main/main.py index 3005ffa..5fe3336 100755 --- a/CFM_main/main.py +++ b/CFM_main/main.py @@ -22,7 +22,7 @@ __author__ = "C. Max Stevens, Vincent Verjans, Brita Horlings, Annika Horlings, Jessica Lundin" __license__ = "MIT" -__version__ = "1.1.8" +__version__ = "1.1.10" __maintainer__ = "Max Stevens" __email__ = "maxstev@umd.edu" __status__ = "Production" diff --git a/CFM_main/strain.py b/CFM_main/strain.py index cbd80d4..34bf74d 100644 --- a/CFM_main/strain.py +++ b/CFM_main/strain.py @@ -28,6 +28,7 @@ def check_strain_settings(self): # Check for deprecated config keys. if 'strain' in self.c: self.c['horizontal_divergence'] = self.c['strain'] + if 'InputFileNamedudx' in self.c: self.c['InputFileNameStrain'] = self.c['InputFileNamedudx'] # Check if strain settings are set in the config. Otherwise deactivate. diff --git a/changelog.md b/changelog.md index f636ea4..669e4a4 100644 --- a/changelog.md +++ b/changelog.md @@ -3,8 +3,16 @@ All notable changes to the Community Firn Model should be documented in this fil TL;DR: Write down the changes that you made to the the model in this document and update the version number here and in main.py, then update master on github. +To run the update: +git commit -a -m "updating to vX.Y.Z. Details in changelog." +git push +git tag -a vX.Y.Z -m "CFM version vX.Y.Z" +git push origin vX.Y.Z + +Then, on github do a release, which will trigger an updated DOI. + ## Current Version -1.1.9 +1.1.10 ## Full Documentation @@ -23,6 +31,11 @@ https://communityfirnmodel.readthedocs.io/en/latest/ - Goujon physics work, but could possibly be implemented more elegantly (it would be nice to avoid globals) - Not exactly in progress, but at some point adding a log file that gets saved in the results folder would be a good idea. +## [1.1.10] +### Notes +- Version 1.1.10 is a minor update to fix an issue with the strain softening routine introduced in v1.1.9. (The code would throw an error if InputFileNamedudx was not in the .json). +- There is a small update to the documentation regarding BCO outputs. + ## [1.1.9] ### Notes - Version 1.1.9 is an update to add strain softening as described by Oraschewski and Grinsted (2021; https://doi.org/10.5194/tc-2021-240) diff --git a/docs/running/outputs.rst b/docs/running/outputs.rst index 9715b2d..c1cc797 100644 --- a/docs/running/outputs.rst +++ b/docs/running/outputs.rst @@ -45,7 +45,7 @@ Firn air to a horizon (7) is there because due to the model's lagrangian format, (I'd advise using caution if you use the modeled elevation change fields - we have made changes to the code to merge deeper nodes together to save computing time, but in doing so that can make the model-outputed dH have blips in it. If you want to work with this field let me know and I can do a bit of testing. I'd recommend structuring your analyses around the FAC variable.) -BCO: bubble close-off properties. 10 columns: time, Martinerie close-off age, Marinerie close-off depth, age of 830 kg m-3 density horizon, depth of 830 kg m-3 density horizon, Martinerie lock-in age, Marinerie lock-in depth, age of 815 kg m-3 density horizon, depth of 815 kg m-3 density horizon, depth of zero porosity. +BCO: bubble close-off properties. 10 columns: time, Martinerie close-off age, Martinerie close-off depth, age of 830 kg m-3 density horizon, depth of 830 kg m-3 density horizon, Martinerie lock-in age, Martinerie lock-in depth, age of 815 kg m-3 density horizon, depth of 815 kg m-3 density horizon, depth of zero closed porosity. The Martinerie fields refer to paramaterizations for close-off properties published by Patricia Martinerie in the early 1990s. See references below. meltvol: two columnes: decimal time, total melt volume at that time step [m w.e.] @@ -53,3 +53,10 @@ refreeze: two columns: decimal time, total liquid water refreezing at that time runoff: two columns: decimal time, total liquid water runoff at that time step [m w.e.] +**References** +*Goujon, C., Barnola, J.-M., and Ritz, C. (2003), Modeling the densification of polar firn including heat diffusion: Application to close-off characteristics and gas isotopic fractionation for Antarctica and Greenland sites, J. Geophys. Res., 108, 4792, doi:10.1029/2002JD003319, D24.* + +*Martinerie, P., Lipenkov, V. Y., Raynaud, D., Chappellaz, J., Barkov, N. I., and Lorius, C. (1994), Air content paleo record in the Vostok ice core (Antarctica): A mixed record of climatic and glaciological parameters, J. Geophys. Res., 99( D5), 10565– 10576, doi:10.1029/93JD03223.* + +*Martinerie, P., Raynaud, D., Etheridge, D. M., Barnola, J.-M., & Mazaudier, D. (1992, August). Physical and climatic parameters which influence the air content in polar ice. Earth and Planetary Science Letters. Elsevier BV. https://doi.org/10.1016/0012-821x(92)90002-d* +