-
Notifications
You must be signed in to change notification settings - Fork 105
Diagnostically track forest edge #1432
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
samsrabin
wants to merge
114
commits into
NGEET:main
Choose a base branch
from
samsrabin:edge-area-202410
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
114 commits
Select commit
Hold shift + click to select a range
30541e7
Add FatesEcotypesMod and support infrastructure.
samsrabin 436d0ef
Add useful parameter files.
samsrabin cdd5854
Add IS_FOREST* and other useful outputs.
samsrabin 3a72788
Avoid arrays for experimental forest definitions.
samsrabin a1b7ee7
is_patch_forest_tcthresh(): Handle 0-area patches.
samsrabin 60191cf
Combine isforest functions into one.
samsrabin d5e9642
Add FatesEdgeForestMod and testing.
samsrabin f3e4e2e
Add FATES_FOREST_AREA_EB history output.
samsrabin 15291b8
Move edge bin parameters to FATES param file.
samsrabin ecf7ec1
My diagnostic outputs now use group_dyna_*.
samsrabin 54e543d
Delete unneeded use "FatesIOVariableKindMod" in FatesHistoryInterface…
samsrabin aa3b3b9
Fix and rename edge forest bin variables.
samsrabin 21efc2c
Cleanup
samsrabin d3cd1d4
Revert "My diagnostic outputs now use group_dyna_*."
samsrabin b1858ab
Revert "Delete unneeded use "FatesIOVariableKindMod" in FatesHistoryI…
samsrabin 15112f8
Revert "Revert "My diagnostic outputs now use group_dyna_*.""
samsrabin 870d928
Move FATES_IS_FOREST_AP calc to update_history_dyn2_ageclass().
samsrabin a8f9da0
Revert "Revert "Delete unneeded use "FatesIOVariableKindMod" in Fates…
samsrabin 6e0d63f
Remove ED_val_edgeforest_decay from FatesConstantsMod.
samsrabin e200957
Add some .cdl parameter files.
samsrabin 69a5946
Merge branch 'refactor-history-2' into edge-area-202410
samsrabin fe31f1d
Remove check that edge forest param lengths match nlevedgeforest.
samsrabin 0f73382
Remove unused edge bin param use statements.
samsrabin 7c2ae8a
Fix error from merge of refactor-history-2.
samsrabin bc6c6bd
Replace edge forest parameters in code. BROKEN (intentionally).
samsrabin 7cd5631
Add param file to work with previous.
samsrabin f83e79c
Merge tag 'sci.1.78.0_api.36.0.0' into edge-area-202410
samsrabin 6ae8443
Merge tag 'sci.1.78.1_api.36.0.0' into edge-area-202410
samsrabin 784e050
Merge tag 'sci.1.78.2_api.36.0.0' into edge-area-202410
samsrabin ebefc1c
Merge tag 'sci.1.79.1_api.36.1.0' into edge-area-202410
samsrabin 9faeb35
Merge tag 'sci.1.79.1_api.36.1.0_tools.2.1.0' into edge-area-202410
samsrabin e4e710c
Merge tag 'sci.1.79.2_api.36.1.0' into edge-area-202410
samsrabin b70d12f
Merge tag 'sci.1.79.3_api.37.0.0' into edge-area-202410
samsrabin a0f0619
Merge tag 'sci.1.80.0_api.37.0.0' into edge-area-202410
samsrabin 14d854a
Merge tag 'sci.1.80.10_api.37.0.0' into edge-area-202410
samsrabin 2bcf4ad
Merge tag 'sci.1.80.11_api.37.0.0' into edge-area-202410
samsrabin 3fc52fd
Merge tag 'sci.1.80.12_api.37.0.0' into edge-area-202410
samsrabin 826d246
Merge tag 'sci.1.80.13_api.37.0.0' into edge-area-202410
samsrabin 4d5e9f4
Merge tag 'sci.1.80.14_api.37.0.0' into edge-area-202410
samsrabin c97f24d
Merge tag 'sci.1.81.0_api.37.1.0' into edge-area-202410
samsrabin 25d788c
Merge tag 'sci.1.81.1_api.37.1.0' into edge-area-202410
samsrabin b086894
Merge tag 'sci.1.81.1_api.38.0.0' into edge-area-202410
samsrabin c7627a7
Merge tag 'sci.1.82.4_api.39.0.0' into edge-area-202410
samsrabin 9eef47a
Merge tag 'sci.1.82.5_api.39.0.0' into edge-area-202410
samsrabin b959e46
Merge tag 'sci.1.83.0_api.39.0.0' into edge-area-202410
samsrabin f31ebbd
Merge tag 'sci.1.83.1_api.39.0.0' into edge-area-202410
samsrabin d9845cd
Merge tag 'sci.1.84.0_api.40.0.0' into edge-area-202410
samsrabin 39cc40d
Move CalculateTreeGrassAreaSite() to FatesEdgeForestMod.
samsrabin 87f618b
Fix FatesHistoryInterfaceMod.
samsrabin b11baa6
Update default edge params with values from dev .cdl file.
samsrabin 1b74e78
get_fraction_of_edgeforest_in_each_bin() is now called and uses read-…
samsrabin 0b21684
Factor out new subroutine assign_patch_to_bins().
samsrabin a138ca8
Slight refactor of assign_patch_to_bins() for testing.
samsrabin 6053313
Add a unit test of assign_patch_to_bins().
samsrabin 7fc7a20
Merge tag 'sci.1.85.2_api.40.0.0' into edge-area-202410
samsrabin fe6392c
Temporarily comment out some tests that need updating.
samsrabin ec6d636
Fix test_assign_patch_to_bins_01.
samsrabin e228dc3
Trim trailing whitespace from test_EdgeForest.pf.
samsrabin ff96724
Add more tests of assign_patch_to_bins().
samsrabin f438c80
Add test_get_fraction_of_edgeforest_in_each_bin_x0.
samsrabin d546b41
If cell is 100% forest, it's all deep forest.
samsrabin 55cdedf
Fix gffeb_gaussian_numerator().
samsrabin 323e770
Add tests of get_fraction_of_edgeforest_in_each_bin().
samsrabin 927c138
Add test_get_fraction_of_edgeforest_in_each_bin_norm().
samsrabin 82708f8
Add test_gffeb_quadratic().
samsrabin 4ceb9bd
Combine gaussian and lognormal num/denom functions.
samsrabin f656191
Add test_gffeb_gaussian_numerator().
samsrabin d131ac9
Add gffeb_norm() and tests.
samsrabin 84beddc
Add "edge forest" functional test (for now just does allometry tests).
samsrabin 9a4c719
Edge forest test now does edge forest thing. Bad, though.
samsrabin 35a3623
Add lognormal and quadratic fits. Also bad.
samsrabin 5583964
Print parameters for each fit.
samsrabin 2f2f21f
Add function is_param_set().
samsrabin ded84c4
is_param_set(): Compare against fates_check_param_set instead of just…
samsrabin 3b34506
Add bin num to test printout.
samsrabin 70c8632
Fix quadratic test printout.
samsrabin abdcf86
Add plot of forest fraction in every bin.
samsrabin c1940a9
It's FRACTION nonforest, not percent.
samsrabin 97a180f
Fix gffeb_norm_denominator().
samsrabin ed8d688
Fit is fraction FOREST, not fraction nonforest.
samsrabin 3fc2a31
Replace one test values with something independent.
samsrabin 12f21da
Add checks of edge forest parameters.
samsrabin 9759e2f
FatesInterfaceMod: Refactor a confusing nested if-block.
samsrabin af1eb80
Add hlm_use_edge_forest flag.
samsrabin 01b8be2
Explicitly import shr_infnan_isnan.
samsrabin 2dc6817
Compare hlm_use_edge_forest to itrue.
samsrabin cab8e6f
Add newlines at end of new files.
samsrabin a72885a
Add and use utility function logical_to_real().
samsrabin 8462bf2
Merge branch 'fix_testing_ssr' into edge-area-202410
samsrabin 61a24ed
Make logical_to_real() public.
samsrabin 235c88f
Functional tests: Import utils_plotting.
samsrabin 26fb9a0
Edge forest functional test: Use new sample_colormap().
samsrabin 471ed00
Edge forest functional test: Edge distances in legend.
samsrabin f8a62fd
Edge forest functional testing: Add dashed line for normalized.
samsrabin ec60dfb
Change longname of fates_levedge.
samsrabin e30b402
Delete experimental parameter files.
samsrabin 824ec00
Clean up FATES edge forest work.
samsrabin 118d799
Testing Python: Prep for unit tests reading param files.
samsrabin e88ca2a
Testing bugfix: Convert use_param_file to boolean.
samsrabin efcf267
GetSyntheticPatchData(): Optionally specify one patch name.
samsrabin 3ed9356
Add Ecotypes unit test. FAILING!
samsrabin 1327b01
Fix is_patch_forest() w/ grass biomass. FIXES ecotypes test.
samsrabin 2b63956
Testing: Print final parameter file path.
samsrabin db5bea4
Merge branch 'main' into edge-area-202410
samsrabin a5f5a3b
Merge tag 'sci.1.87.0_api.41.0.0' into edge-area-202410
samsrabin 4d3b7d4
Don't set nlevedgeforest=1 if hlm_use_edge_forest false.
samsrabin 233e525
Remove an unused 'use hlm_use_tree_damage'.
samsrabin 7ffd6f0
Change procedure names from snake_case to PascalCase.
samsrabin 4ac9ac1
Move GetNumberOfPatches() from FatesEdgeForestMod to ed_site_type.
samsrabin a8c0c35
Expand description of RankForestEdgeProximity().
samsrabin 1476eb3
Fix docstring in edge_forest_test.py.
samsrabin a88bfb0
test_EdgeForest.pf: Fix test name conflict.
samsrabin 131d93a
Ecotypes unit test: Don't read parameter file.
samsrabin de669c9
Revert some now-unneeded changes to testing scripts.
samsrabin File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 |
|---|---|---|
|
|
@@ -605,12 +605,12 @@ module EDTypesMod | |
|
|
||
| procedure, public :: get_current_landuse_statevector | ||
| procedure, public :: get_secondary_young_fraction | ||
| procedure, public :: GetNumberOfPatches | ||
|
|
||
| end type ed_site_type | ||
|
|
||
| ! Make public necessary subroutines and functions | ||
| public :: dump_site | ||
| public :: CalculateTreeGrassAreaSite | ||
| public :: set_patchno | ||
|
|
||
| contains | ||
|
|
@@ -737,39 +737,6 @@ end subroutine ZeroMassBalFlux | |
|
|
||
| ! ===================================================================================== | ||
|
|
||
| subroutine CalculateTreeGrassAreaSite(csite, tree_fraction, grass_fraction, bare_fraction) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Moved to FatesEdgeForestMod, I think because of circular dependencies. |
||
| ! | ||
| ! DESCRIPTION: | ||
| ! Calculates total grass, tree, and bare fractions for a site | ||
|
|
||
| ! ARGUMENTS: | ||
| type(ed_site_type), intent(inout) :: csite ! site object | ||
| real(r8), intent(out) :: tree_fraction ! total site tree fraction | ||
| real(r8), intent(out) :: grass_fraction ! total site grass fraction | ||
| real(r8), intent(out) :: bare_fraction ! total site bare fraction | ||
|
|
||
| ! LOCALS: | ||
| type(fates_patch_type), pointer :: currentPatch ! patch object | ||
|
|
||
| tree_fraction = 0.0_r8 | ||
| grass_fraction = 0.0_r8 | ||
|
|
||
| currentPatch => csite%oldest_patch | ||
| do while(associated(currentPatch)) | ||
| if (currentPatch%nocomp_pft_label /= nocomp_bareground) then | ||
| call currentPatch%UpdateTreeGrassArea() | ||
| tree_fraction = tree_fraction + currentPatch%total_tree_area/AREA | ||
| grass_fraction = grass_fraction + currentPatch%total_grass_area/AREA | ||
| end if | ||
| currentPatch => currentPatch%younger | ||
| end do | ||
|
|
||
| ! if cover > 1.0, grasses are under the trees | ||
| grass_fraction = min(grass_fraction, 1.0_r8 - tree_fraction) | ||
| bare_fraction = 1.0_r8 - tree_fraction - grass_fraction | ||
|
|
||
| end subroutine CalculateTreeGrassAreaSite | ||
|
|
||
| !--------------------------------------------------------------------------------------- | ||
|
|
||
| subroutine dump_site(csite) | ||
|
|
@@ -865,4 +832,26 @@ function get_secondary_young_fraction(this) result(secondary_young_fraction) | |
|
|
||
| end function get_secondary_young_fraction | ||
|
|
||
| function GetNumberOfPatches(this) result(n_patches) | ||
| ! DESCRIPTION | ||
| ! Returns number of patches at site | ||
| ! | ||
| ! ARGUMENTS: | ||
| class(ed_site_type) :: this | ||
| ! | ||
| ! RETURN VALUE: | ||
| integer :: n_patches | ||
| ! | ||
| ! LOCAL VARIABLES: | ||
| type(fates_patch_type), pointer :: currentPatch | ||
|
|
||
| n_patches = 0 | ||
| currentPatch => this%youngest_patch | ||
| do while(associated(currentPatch)) | ||
| n_patches = n_patches + 1 | ||
| currentPatch => currentPatch%older | ||
| enddo | ||
|
|
||
| end function GetNumberOfPatches | ||
|
|
||
| end module EDTypesMod | ||
This file contains hidden or 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,81 @@ | ||
| module FatesEcotypesMod | ||
rgknox marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| use FatesConstantsMod, only : r8 => fates_r8 | ||
| use EDTypesMod, only : ed_site_type | ||
| use FatesPatchMod, only : fates_patch_type | ||
|
|
||
| implicit none | ||
| private ! By default everything is private | ||
|
|
||
| ! Make public necessary subroutines and functions | ||
| public :: IsPatchForest | ||
| ! For unit testing | ||
| public :: DoesPatchHaveForest_TreeCover | ||
| public :: DoesPatchHaveForest_GrassBiomass | ||
|
|
||
| contains | ||
|
|
||
| ! ===================================================================================== | ||
|
|
||
| function DoesPatchHaveForest_TreeCover(patchptr, forest_tree_fraction_threshold) | ||
| ! DESCRIPTION: | ||
| ! Return boolean: Is this patch "forest"? | ||
| ! | ||
| ! ARGUMENTS: | ||
| type(fates_patch_type), intent(in), pointer :: patchptr ! pointer to patch object | ||
| real(r8), intent(in) :: forest_tree_fraction_threshold ! Tree fraction above which a patch is "forest" | ||
| ! | ||
| ! RETURN VALUE | ||
| logical :: DoesPatchHaveForest_TreeCover | ||
| ! | ||
| ! LOCAL VARIABLES | ||
| real(r8) :: tree_fraction = 0._r8 | ||
|
|
||
| if (patchptr%area > 0._r8) then | ||
| tree_fraction = patchptr%total_tree_area / patchptr%area | ||
| else | ||
| tree_fraction = 0._r8 | ||
| end if | ||
|
|
||
| DoesPatchHaveForest_TreeCover = tree_fraction > forest_tree_fraction_threshold | ||
|
|
||
| end function DoesPatchHaveForest_TreeCover | ||
|
|
||
|
|
||
| function DoesPatchHaveForest_GrassBiomass(patchptr, grass_biomass_threshold) | ||
| ! DESCRIPTION: | ||
| ! Return boolean: Does this patch have grass biomass above a threshold? | ||
| ! | ||
| ! ARGUMENTS: | ||
| type(fates_patch_type), intent(in), pointer :: patchptr ! pointer to patch object | ||
| real(r8), intent(in) :: grass_biomass_threshold ! Live grass biomass (kgC/m2) above which a patch is considered to "have grass" | ||
| ! | ||
| ! RETURN VALUE | ||
| logical :: DoesPatchHaveForest_GrassBiomass | ||
|
|
||
| DoesPatchHaveForest_GrassBiomass = patchptr%livegrass > grass_biomass_threshold | ||
|
|
||
| end function DoesPatchHaveForest_GrassBiomass | ||
|
|
||
|
|
||
| function IsPatchForest(patchptr, forest_tree_fraction_threshold, grass_biomass_threshold) | ||
| ! DESCRIPTION: | ||
| ! Return boolean: Is this patch forest according to tree cover and, optionally, grass biomass? | ||
| ! | ||
| ! ARGUMENTS: | ||
| type(fates_patch_type), intent(in), pointer :: patchptr ! pointer to patch object | ||
| real(r8), intent(in) :: forest_tree_fraction_threshold ! Tree fraction above which a patch is "forest" | ||
| real(r8), intent(in), optional :: grass_biomass_threshold ! Live grass biomass (kgC/m2) above which a patch is considered to "have grass" | ||
| ! | ||
| ! RETURN VALUE | ||
| logical :: IsPatchForest | ||
|
|
||
| IsPatchForest = DoesPatchHaveForest_TreeCover(patchptr, forest_tree_fraction_threshold) | ||
| if (IsPatchForest .and. present(grass_biomass_threshold)) then | ||
| IsPatchForest = .not. DoesPatchHaveForest_GrassBiomass(patchptr, grass_biomass_threshold) | ||
| end if | ||
|
|
||
| end function IsPatchForest | ||
|
|
||
|
|
||
| end module FatesEcotypesMod | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@samsrabin these are also still allocated here: https://github.com/samsrabin/fates/blob/edge-area-202410/main/EDParamsMod.F90#L119
Do we need to remove those statements?