Changeset 28065


Ignore:
Timestamp:
01/24/24 10:39:30 (14 months ago)
Author:
bgetraer
Message:

CHG: interpISMIP6 function inputs define model with single string, simplify nc file identification

Location:
issm/trunk-jpl/src/m/parameterization
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk-jpl/src/m/parameterization/interpISMIP6AntarcticaOcn.m

    r28054 r28065  
    1 function basalforcings = interpISMIP6AntarcticaOcn(md,model_name,scenario)
     1function basalforcings = interpISMIP6AntarcticaOcn(md,model_name)
    22%interpISMIP6AntarcticaOcn - interpolate chosen ISMIP6 atmospheric forcing to model
    33%
    44%   Input:
    55%     - md (model object)
    6 %     - model_name  (string): name of the climate model
    7 %                             Examples: cnrm-esm2-1 ccsm4cesm2 cnrm-cm6-1 csiro-mk3-6-0
    8 %                                       hadgem2-es ipsl-cm5a-mr miroc-esm-chem noresm1-m ukesm1-0-ll
     6%     - model_name (string): name of the climate model and scenario
     7%       - suppported options from /totten_1/ModelData/ISMIP6/Projections/AIS/Ocean_Forcing/
     8%             2.6 scenario             8.5 scenario
     9%             ---------------------------------------------
     10%                                      ccsm4_rcp8.5
     11%                                      cesm2_ssp585
     12%             cnrm-cm6-1_ssp126        cnrm-cm6-1_ssp585
     13%                                      cnrm-esm2-1_ssp585
     14%                                      csiro-mk3-6-0_rcp8.5
     15%                                      hadgem2-es_rcp8.5
     16%             ipsl-cm5a-mr_rcp2.6      ipsl-cm5a-mr_rcp8.5
     17%                                      miroc-esm-chem_rcp8.5
     18%             noresm1-m_rcp2.6         noresm1-m_rcp8.5
     19%                                      ukesm1-0-ll_ssp585
    920%
    10 %     - scenario    (string): name of the climate scenario
    11 %                             Examples: rcp2.6, rcp8.5, ssp126, ssp585
    1221%   Output:
    13 %     - basalforcings: prepared to be input directly into md.smb
     22%     - basalforcings: prepared to be input directly into md.basalforcings
     23%                      time series from 1995-2100
    1424%
    1525%   Examples:
    16 %      md.basalforcings = interpISMIP6AntarcticaOcn(md,'miroc-esm-chem','rcp8.5');
     26%      md.basalforcings = interpISMIP6AntarcticaOcn(md,'miroc-esm-chem_rcp8.5');
    1727
    1828% Find appropriate directory
     
    2434end
    2535
    26 %Find forcing file
    27 rootname = [path model_name '_' scenario '/1995-2100'];
    28 list = dir(rootname);
    29 found = false;
    30 for i=1:numel(list)
    31         if strcmpi(list(i).name, [model_name '_thermal_forcing_8km_x_60m.nc'])
    32                 disp(['Found tf file: ' list(i).name]);
    33                 tfnc = [rootname '/' list(i).name];
    34                 found = true;
    35         end
     36% search for thermal forcing file in the ISMIP climate model directory
     37rootname=[path model_name '/1995-2100/']; % root directory for the climate model files
     38tffile=dir([rootname '*_thermal_forcing_8km_x_60m.nc']); % thermal forcing file if found
     39
     40% throw error if file not found, or if the file search is not unique
     41if length(tffile)~=1
     42   error(['this path does not exist or is not unique under ' rootname]);
    3643end
    37 if ~found
    38    error(['this path does not exist or the ' model_name ' and ' scenario ' are not available in this combination.']);
    39 end
     44
     45% save the full path of the found files
     46tfnc=[rootname tffile.name];
    4047
    4148%load TF data
  • issm/trunk-jpl/src/m/parameterization/interpISMIP6AntarcticaSMB.m

    r28054 r28065  
    1 function smb = interpISMIP6AntarcticaSMB(md,model_name,scenario)
     1function smb = interpISMIP6AntarcticaSMB(md,model_name)
    22%interpISMIP6AntarcticaSMB - interpolate chosen ISMIP6 atmospheric forcing to model
    33%
    44%   Input:
    55%     - md (model object)
    6 %     - model_name  (string): name of the climate model
    7 %                             Examples: CESM2 CNRM_CM6 CNRM_ESM2 CSIRO-Mk3-6-0 HadGEM2-ES IPSL-CM5A-MR
    8 %                                       ccsm4 miroc-esm-chem noresm1-m
    9 %     - scenario    (string): name of the climate scenario
    10 %                             Examples: rcp26, rcp85, ssp126, ssp585
     6%     - model_name (string): name of the climate model and scenario
     7%       - suppported options from /totten_1/ModelData/ISMIP6/Projections/AIS/Atmosphere_Forcing/
     8%             2.6 scenario             8.5 scenario
     9%             ---------------------------------------------
     10%             ccsm4_rcp2.6             ccsm4_rcp8.5
     11%                                      CESM2_ssp585
     12%             CNRM_CM6_ssp126          CNRM_CM6_ssp585
     13%                                      CNRM_ESM2_ssp585
     14%                                      CSIRO-Mk3-6-0_rcp85
     15%                                      HadGEM2-ES_rcp85
     16%             IPSL-CM5A-MR_rcp26       IPSL-CM5A-MR_rcp85
     17%             miroc-esm-chem_rcp2.6    miroc-esm-chem_rcp8.5
     18%             noresm1-m_rcp2.6         noresm1-m_rcp8.5
     19%
    1120%   Output:
    1221%     - smb: prepared to be input directly into md.smb
     22%            time series from 1995-2100
    1323%
    1424%   Examples:
    15 %      md.smb = interpISMIP6AntarcticaSMB(md,'miroc-esm-chem','rcp8.5');
     25%      md.smb = interpISMIP6AntarcticaSMB(md,'miroc-esm-chem_rcp8.5');
    1626
    1727% Find appropriate directory
     
    2333end
    2434
    25 %find which files are available and do a case insensitive test
    26 rootname = [path model_name '_' scenario '/'];
    27 list = dir([rootname '/Regridded_2km/']);
    28 found1 = false; found2 = false;
    29 for i=1:numel(list)
    30         if strcmpi(list(i).name, [model_name '_2km_clim_1995-2014.nc'])
    31                 disp(['Found clim file: ' list(i).name]);
    32                 smbclimnc = [rootname '/Regridded_2km/' list(i).name];
    33                 found1 = true;
    34         end
    35         if strcmpi(list(i).name, [model_name '_2km_anomaly_1995-2100.nc'])
    36                 disp(['Found anom file: ' list(i).name]);
    37                 smbanomnc = [rootname '/Regridded_2km/' list(i).name];
    38                 found2 = true;
    39         end
    40 end
    41 if ~found1 || ~found2
    42    error(['this path does not exist or the ' model_name ' and ' scenario ' are not available in this combination.']);
     35% search for smb files in the ISMIP climate model directory
     36rootname=[path model_name '/Regridded_2km/']; % root directory for the climate model files
     37smbclimfile=dir([rootname '*_2km_clim_1995-2014.nc']); % climatology file if found
     38smbanomfile=dir([rootname '*_2km_anomaly_1995-2100.nc']); % anomaly file if found
     39
     40% throw error if files are not found, or if the file search is not unique
     41if length(smbclimfile)~=1 || length(smbanomfile)~=1
     42   error(['this path does not exist or is not unique under ' rootname]);
    4343end
    4444
     45% save the full path of the found files
     46smbclimnc=[rootname smbclimfile.name];
     47smbanomnc=[rootname smbanomfile.name];
     48
     49% load data from files
    4550disp('   == loading TS and SMB climatology data');
    4651lat                 = double(ncread(smbclimnc,'lat'));
Note: See TracChangeset for help on using the changeset viewer.