Skip to content

Add a new testcase for processing ismip6 shelf-collapse mask data#515

Merged
matthewhoffman merged 10 commits intoMPAS-Dev:mainfrom
hollyhan:add_ismip6_forcing_shelf
Apr 3, 2024
Merged

Add a new testcase for processing ismip6 shelf-collapse mask data#515
matthewhoffman merged 10 commits intoMPAS-Dev:mainfrom
hollyhan:add_ismip6_forcing_shelf

Conversation

@hollyhan
Copy link
Contributor

@hollyhan hollyhan commented Jan 30, 2023

ISMIP6-2300 experimental protocol provides ice-shelf collapse masks for their Tier2 experiments to investigate the effects of ice-shelf collapse on the dynamics of the Antarctic Ice Sheet.

This PR adds a test case that processes the original ismip6 shelf mask to the existing compass ismip6_forcing test group. It also refactors the operations for creating mapping files to simplify the code.

@hollyhan hollyhan added enhancement New feature or request in progress This PR is not ready for review or merging land ice labels Jan 30, 2023
Copy link
Member

@matthewhoffman matthewhoffman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@hollyhan , thanks for getting this implementing and opening the PR. It will be great to have the complete ismip6 forcing capability complete and behind us soon!

I have a few comments to look at. The major issue I found is an error with ncap2 described below. I can't figure out why it is failing, so it might be an issue/bug with ncap2 and not this PR, but those lines are not actually necessary, so we might want to just remove them. I tried commenting them out and running the test case, and I was able to successfully create a mask forcing file. I did not run MALI with it, but visual inspection of the values looked correct to me.

Let me know what you think about this ncap2 issue and the other minor things I mention, and I can re-review.

mali_mesh_file = section.get("mali_mesh_file")

# we always want neareststod for the remapping method because we want
# a value between 0 and 1 per mesh point.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# a value between 0 and 1 per mesh point.
# a value of 0 or 1 at each mesh point.

self.rename_ismip6_shelf_mask_to_mali_vars(remapped_file_temp,
output_file)

# round up/down the mask values to 1/0
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Presumably this is not necessary if using the neareststod remapping method. It certainly doesn't hurt and would be needed if the interpolation method was changed, but add a comment pointing that out.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, I'm seeing an error causing compass to abort at this line. I ran this command manually in the workdir and got this result:

ncap2 -O -s "where(calvingMask>=0.5) calvingMask=1" Thwaites_4to20km_r02_20230126_ice_shelf_collapse_mask_UKESM1-0-LL_ssp585_1995-2300_08km.nc
ncap2: WARNING prs_cls::ncap_var_init(): Unable to find variable calvingMask in ncap2_tmp_dmm.nc.pid31776 or Thwaites_4to20km_r02_20230126_ice_shelf_collapse_mask_UKESM1-0-LL_ssp585_1995-2300_08km.nc
ncap2: ERROR out(): Could not read var calvingMask

I don't see what the problem is, because I confirmed that variable is indeed in the file with the correct spelling and dimensions. Maybe it's an issue with ncap2 and integer fields? I'm curious if anyone else runs into this.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe the error has to do with the -O flag to ncap2. If the -O flag is replaced with -A I'm able to execute the problem line without any problem (e.g.):

ncap2 -A -s "where(calvingMask>=0.5) calvingMask=1" $FILE_NAME.nc

I've never really used ncap2 so I'm not sure if there's a problem with switching from -O to -A. I wonder if it would make more sense to switch to xarray to do the rounding. Just feels a little weird to call a command line utility to do NetCDF arithmetic within python, but I could be missing something. Or maybe we can remove these lines all together since the interpolation method is hardcoded as neareststod.


# input files: input uniform melt rate coefficient (gamma0)
_files = {
#"2100": Will be added later
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm fine with leaving this out for now. Honestly, it's unlikely we'll redo any of the original experiments. I imagine even if we only want to run to 2100, we are likely to use the 2300 forcing time series.

output_base_path = section.get("output_base_path")
model = section.get("model")
scenario = section.get("scenario")
res_ismip6 = section.get("res_ismip6")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like this is not in the cfg in this branch. I assume it's in the 4km forcing branch you are working on. Should we wait and merge this PR after that one? That might be easier than trying to make this PR work without that option. Also, can you open a PR for that one so we don't lose track of it?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Following up - it looks like the 4km PR has already been merged, and this option just needs to be added to the default cfg file in these test cases.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But it also seems that the res_ismip6 option is not being applied in the ocean_basal and ocean_thermal test cases, unless I'm missing someething. It is in the atmosphere test case, though. It would be good to fix that up in this PR.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, I see, the ocean cases only have 8km data available, so there is no need to change the resolution for those cases. The error I am seeing comes from that issue with capital vs. lowercase F in the Ocean_forcing subdirectory name.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah yeah, I remember having to make symlinks to directories so that I could have both Ocean_Forcing and Ocean_forcing, depending on which resolution I was using.


model_list_2300 = ["CCSM4", "CESM2-WACCM","HadGEM2-ES","UKESM1-0-LL"]
if period_endyear != 2300 and model not in model_list_2300:
raise ValueError(f"ice shelf-collapse masks are provided by the "
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This error check is great to have, but the message is inconsistent with the check itself - the check does not include the specific scenarios for each model, but the message does.

A less complicated check could be to write a try/except clause around line 55 and provide a general error if the requested combination is not available in the _files dict.

hollyhan and others added 2 commits February 22, 2024 15:54
- Rebased branch onto main

- Fixed `ncap` bug caused by the `-O` flag. Switched to `-A` and
  combined the two `ncap` calls into one using `elsewhere` clause.

- Added more information to the error message of when the model /
  scenario combinations are not valid for the shelf collpase exper.

- Added a `data_res` config option to the `shelf_collapse` and
  `atmospheric` testcase configuration sections of the the config
  file. `data_res` was added at the testcase level (c.f. testgroup)
  b/c not all testcases provide data at multiple resoltion
  (e.g. `ocean_forcing`).
@andrewdnolan andrewdnolan force-pushed the add_ismip6_forcing_shelf branch from daccead to 769061c Compare March 11, 2024 17:36
- created a single `build_mapping_file` function at the testcase level
  which takes a `scrip_from_latlon` parameter that determines what
  coordinate varibale should be used to generate the scrip file from
  interpolarion.
- suppressed flake8 formatting error related to lines over 80 charac.
@andrewdnolan
Copy link
Collaborator

Testing

  • Machine: Chicoma
  • compass version: 1.2.0-alpha.9

Command run:

compass setup -n 88 89 90 91 92 -f ismip6_forcing.cfg  -w work_dir
Where "ismip6_forcing.cfg" contains
# config options for ismip6 antarctic ice sheet data set
[ismip6_ais]

# Base path to the input ismip6 ocean and smb forcing files. User has to supply.
base_path_ismip6 = /lustre/scratch5/mhoffman/ISMIP6_Projections_Forcing_2300

# Base path to the the MALI mesh. User has to supply.
base_path_mali = /lustre/scratch5/anolan/shelf_collapse

# Forcing end year of the ISMIP6 data. User has to supply.
# Available end years are 2100 and 2300.
period_endyear = 2300

# Base path to which output forcing files are saved.
output_base_path = /lustre/scratch5/anolan/shelf_collapse/output

# Name of climate model name used to generate ISMIP6 forcing data. User has to supply.
# Available model names are the following: CCSM4, CESM2-WACCM, CSIRO-Mk3-6-0, HadGEM2-ES, NorESM1-M, UKESM1-0-LL
model =  CCSM4

# Scenarios used by climate model. User has to supply.
# Available scenarios are the following: RCP26, RCP85, SSP126, SSP585
scenario = RCP85

# name of the mali mesh. User has to supply. Note: It is used to name mapping files
# (e,g. 'map_ismip6_8km_to_{mali_mesh_name}_{method_remap}.nc').
mali_mesh_name = test

# MALI mesh file to be used to build mapping file (e.g.Antarctic_8to80km_20220407.nc). User has to supply.
mali_mesh_file = Antarctica.nc


# config options for ismip6 antarctic ice shelf collpase forcing test cases
[ismip6_ais_shelf_collapse]

# resolution of CMIP6 model data to be used
data_resolution = 8km

# config options for ismip6 antarctic ice sheet SMB forcing data test cases
[ismip6_ais_atmosphere]

# resolution of CMIP6 model data to be used
data_resolution = 4km

# Remapping method used in building a mapping file. Options include: bilinear, neareststod, conserve
method_remap = bilinear

# Set True to process RACMO modern climatology
process_smb_racmo = True

# config options for ismip6 ocean thermal forcing data test cases
[ismip6_ais_ocean_thermal]

# Remapping method used in building a mapping file. Options include: bilinear, neareststod, conserve
method_remap = bilinear

Results

landice/ismip6_forcing/atmosphere
  * step: process_smb_racmo
  * step: process_smb
  test execution:      SUCCESS
  test runtime:        09:14
landice/ismip6_forcing/ocean_basal
  * step: process_basal_melt
  test execution:      SUCCESS
  test runtime:        00:58
landice/ismip6_forcing/ocean_thermal_obs
  * step: process_thermal_forcing
  test execution:      SUCCESS
  test runtime:        00:25
landice/ismip6_forcing/ocean_thermal
  * step: process_thermal_forcing
  test execution:      SUCCESS
  test runtime:        03:56
landice/ismip6_forcing/shelf_collapse
  * step: process_shelf_collapse
  test execution:      SUCCESS
  test runtime:        00:42
Test Runtimes:
09:14 PASS landice_ismip6_forcing_atmosphere
00:58 PASS landice_ismip6_forcing_ocean_basal
00:25 PASS landice_ismip6_forcing_ocean_thermal_obs
03:56 PASS landice_ismip6_forcing_ocean_thermal
00:42 PASS landice_ismip6_forcing_shelf_collapse
Total runtime 15:16
PASS: All passed successfully!

I also ran the test suite again to make sure there was no problem with re-running when output files already exits and all test passed like above.

@andrewdnolan
Copy link
Collaborator

Testing (cont.)

I've also done some testing on Perlmutter, which might be a good machine for someone else to run on since we have archives of the ISMIP6 source datasets in the fanssie project space (c.f. on scratch on chicoma).

2100 Test

Command run:

compass setup -n 88 89 90 91 -f ismip6_forcing.cfg -w wrkdir/

Note: Test case 92 is left off for the 2100 test suite since shelf_collapse is currently only supported for 2300 runs.

Where "ismip6_forcing.cfg" contains
# config options for ismip6 antarctic ice sheet data set
[ismip6_ais]

# Base path to the input ismip6 ocean and smb forcing files. User has to supply.
base_path_ismip6 = /global/cfs/cdirs/fanssie/standard_datasets/ISMIP6-Forcing-Ghub

# Base path to the the MALI mesh. User has to supply.
base_path_mali = /global/cfs/cdirs/fanssie/MALI_input_files/AIS_8to80km_r01

# Forcing end year of the ISMIP6 data. User has to supply.
# Available end years are 2100 and 2300.
period_endyear = 2100

# Base path to which output forcing files are saved.
output_base_path = /pscratch/sd/a/anolan/ismip6_shelf_collpase_PR515/output

# Name of climate model name used to generate ISMIP6 forcing data. User has to supply.
# Available model names are the following: CCSM4, CESM2-WACCM, CSIRO-Mk3-6-0, HadGEM2-ES, NorESM1-M, UKESM1-0-LL
model =  CCSM4

# Scenarios used by climate model. User has to supply.
# Available scenarios are the following: RCP26, RCP85, SSP126, SSP585
scenario = RCP85

# name of the mali mesh. User has to supply. Note: It is used to name mapping files
# (e,g. 'map_ismip6_8km_to_{mali_mesh_name}_{method_remap}.nc').
mali_mesh_name = test

# MALI mesh file to be used to build mapping file (e.g.Antarctic_8to80km_20220407.nc). User has to supply.
mali_mesh_file = AIS_8to80km_r01_20220601.nc


# config options for ismip6 antarctic ice shelf collpase forcing test cases
[ismip6_ais_shelf_collapse]

# resolution of CMIP6 model data to be used
data_resolution = 8km

# config options for ismip6 antarctic ice sheet SMB forcing data test cases
[ismip6_ais_atmosphere]

# resolution of CMIP6 model data to be used
data_resolution = 4km

# Remapping method used in building a mapping file. Options include: bilinear, neareststod, conserve
method_remap = bilinear

# Set True to process RACMO modern climatology
process_smb_racmo = True

# config options for ismip6 ocean thermal forcing data test cases
[ismip6_ais_ocean_thermal]

# Remapping method used in building a mapping file. Options include: bilinear, neareststod, conserve
method_remap = bilinear

Results:

landice/ismip6_forcing/atmosphere
  * step: process_smb_racmo
  * step: process_smb
  test execution:      SUCCESS
  test runtime:        02:22
landice/ismip6_forcing/ocean_basal
  * step: process_basal_melt
  test execution:      SUCCESS
  test runtime:        01:15
landice/ismip6_forcing/ocean_thermal_obs
  * step: process_thermal_forcing
  test execution:      SUCCESS
  test runtime:        00:22
landice/ismip6_forcing/ocean_thermal
  * step: process_thermal_forcing
  test execution:      SUCCESS
  test runtime:        00:37
Test Runtimes:
02:22 PASS landice_ismip6_forcing_atmosphere
01:15 PASS landice_ismip6_forcing_ocean_basal
00:22 PASS landice_ismip6_forcing_ocean_thermal_obs
00:37 PASS landice_ismip6_forcing_ocean_thermal
Total runtime 04:49
PASS: All passed successfully!

2300 Test

Command run:

compass setup -n 88 89 90 91 92 -f ismip6_forcing.cfg -w wrkdir/
Where "ismip6_forcing.cfg" contains
# config options for ismip6 antarctic ice sheet data set
[ismip6_ais]

# Base path to the input ismip6 ocean and smb forcing files. User has to supply.
base_path_ismip6 = /global/cfs/cdirs/fanssie/standard_datasets/ISMIP6_Projections_Forcing_2300

# Base path to the the MALI mesh. User has to supply.
base_path_mali = /global/cfs/cdirs/fanssie/MALI_input_files/AIS_8to80km_r01

# Forcing end year of the ISMIP6 data. User has to supply.
# Available end years are 2100 and 2300.
period_endyear = 2300

# Base path to which output forcing files are saved.
output_base_path = /pscratch/sd/a/anolan/ismip6_shelf_collpase_PR515/output

# Name of climate model name used to generate ISMIP6 forcing data. User has to supply.
# Available model names are the following: CCSM4, CESM2-WACCM, CSIRO-Mk3-6-0, HadGEM2-ES, NorESM1-M, UKESM1-0-LL
model =  CCSM4

# Scenarios used by climate model. User has to supply.
# Available scenarios are the following: RCP26, RCP85, SSP126, SSP585
scenario = RCP85

# name of the mali mesh. User has to supply. Note: It is used to name mapping files
# (e,g. 'map_ismip6_8km_to_{mali_mesh_name}_{method_remap}.nc').
mali_mesh_name = test

# MALI mesh file to be used to build mapping file (e.g.Antarctic_8to80km_20220407.nc). User has to supply.
mali_mesh_file = AIS_8to80km_r01_20220601.nc


# config options for ismip6 antarctic ice shelf collpase forcing test cases
[ismip6_ais_shelf_collapse]

# resolution of CMIP6 model data to be used
data_resolution = 8km

# config options for ismip6 antarctic ice sheet SMB forcing data test cases
[ismip6_ais_atmosphere]

# resolution of CMIP6 model data to be used
data_resolution = 4km

# Remapping method used in building a mapping file. Options include: bilinear, neareststod, conserve
method_remap = bilinear

# Set True to process RACMO modern climatology
process_smb_racmo = True

# config options for ismip6 ocean thermal forcing data test cases
[ismip6_ais_ocean_thermal]

# Remapping method used in building a mapping file. Options include: bilinear, neareststod, conserve
method_remap = bilinear

Results:

landice/ismip6_forcing/atmosphere
  * step: process_smb_racmo
  * step: process_smb
  test execution:      SUCCESS
  test runtime:        02:57
landice/ismip6_forcing/ocean_basal
  * step: process_basal_melt
  test execution:      SUCCESS
  test runtime:        00:16
landice/ismip6_forcing/ocean_thermal_obs
  * step: process_thermal_forcing
  test execution:      SUCCESS
  test runtime:        00:07
landice/ismip6_forcing/ocean_thermal
  * step: process_thermal_forcing
  test execution:      SUCCESS
  test runtime:        00:44
landice/ismip6_forcing/shelf_collapse
  * step: process_shelf_collapse
  test execution:      SUCCESS
  test runtime:        00:17
Test Runtimes:
02:57 PASS landice_ismip6_forcing_atmosphere
00:16 PASS landice_ismip6_forcing_ocean_basal
00:07 PASS landice_ismip6_forcing_ocean_thermal_obs
00:44 PASS landice_ismip6_forcing_ocean_thermal
00:17 PASS landice_ismip6_forcing_shelf_collapse
Total runtime 04:28
PASS: All passed successfully!

@andrewdnolan
Copy link
Collaborator

Note for the perlmutter testing above I was able to use the updated testcase to run both 2100 and 2300 without running into the forcing/Forcing issue described above. Also, with the updated testcase there's no need to have a symlink between the two directories.

Instead, note that the base_path_ismip6 config option changes between the 2100 and 2300 test. In order for this testcase to work, when the period_endyear changes the base_path_ismip6 has to be changed to match corresponding ISMIP6 archive.

@matthewhoffman matthewhoffman self-requested a review April 1, 2024 23:25
@andrewdnolan andrewdnolan removed the in progress This PR is not ready for review or merging label Apr 2, 2024
@andrewdnolan
Copy link
Collaborator

I've updated the documentation to include the shelf_collapse test case and added a note about avoiding the forcing/Forcing problem described above.

You can find the built documentation here:
https://portal.nersc.gov/cfs/fanssie/anolan/shelf_collapse/index.html

Copy link
Member

@matthewhoffman matthewhoffman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@andrewdnolan , thanks for your work in getting this PR across the finish line, and thanks to @hollyhan for her work in getting it set up in the first place. I tested running all 5 test cases together on Chicoma as @andrewdnolan had done. I then tested again disabling the RACMO SMB option. Both tests worked without any errors. Based on this and the thorough testing @andrewdnolan included in the discussion, I'm pleased to merge this PR. I noted a few typos in the docs, which I will commit myself before merging.

@matthewhoffman matthewhoffman requested review from andrewdnolan and trhille and removed request for andrewdnolan, trhille and xylar April 3, 2024 01:46
@matthewhoffman matthewhoffman merged commit daff021 into MPAS-Dev:main Apr 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request land ice

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants