Add a new testcase for processing ismip6 shelf-collapse mask data#515
Add a new testcase for processing ismip6 shelf-collapse mask data#515matthewhoffman merged 10 commits intoMPAS-Dev:mainfrom
Conversation
matthewhoffman
left a comment
There was a problem hiding this comment.
@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. |
There was a problem hiding this comment.
| # 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 |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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") |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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 " |
There was a problem hiding this comment.
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.
- 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`).
daccead to
769061c
Compare
- 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.
Testing
Command run: 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 = bilinearResultsI 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. |
Testing (cont.)I've also done some testing on 2100 TestCommand run: Note: Test case 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 = bilinearResults:2300 TestCommand run: 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 = bilinearResults: |
|
Note for the Instead, note that the |
|
I've updated the documentation to include the You can find the built documentation here: |
matthewhoffman
left a comment
There was a problem hiding this comment.
@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.
Minor fixup to docs
ISMIP6-2300 experimental protocol provides ice-shelf collapse masks for their
Tier2 experimentsto 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_forcingtest group. It also refactors the operations for creating mapping files to simplify the code.