[1] | 1 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
---|
| 2 | % |
---|
| 3 | % Build a ROMS boundary file |
---|
| 4 | % |
---|
| 5 | % Extrapole and interpole temperature and salinity from a |
---|
| 6 | % climatology to get boundary conditions for |
---|
| 7 | % ROMS (boundary netcdf file) . |
---|
| 8 | % Get the velocities and sea surface elevation via a |
---|
| 9 | % geostrophic computation. |
---|
| 10 | % |
---|
| 11 | % Data input format (netcdf): |
---|
| 12 | % temperature(T, Z, Y, X) |
---|
| 13 | % T : time [Months] |
---|
| 14 | % Z : Depth [m] |
---|
| 15 | % Y : Latitude [degree north] |
---|
| 16 | % X : Longitude [degree east] |
---|
| 17 | % |
---|
| 18 | % Data source : IRI/LDEO climate Data Library (World Ocean Atlas 1998) |
---|
| 19 | % http://ingrid.ldgo.columbia.edu/ |
---|
| 20 | % http://iridl.ldeo.columbia.edu/SOURCES/.NOAA/.NODC/.WOA98/ |
---|
| 21 | % |
---|
| 22 | % Further Information: |
---|
| 23 | % http://www.brest.ird.fr/Roms_tools/ |
---|
| 24 | % |
---|
| 25 | % This file is part of ROMSTOOLS |
---|
| 26 | % |
---|
| 27 | % ROMSTOOLS is free software; you can redistribute it and/or modify |
---|
| 28 | % it under the terms of the GNU General Public License as published |
---|
| 29 | % by the Free Software Foundation; either version 2 of the License, |
---|
| 30 | % or (at your option) any later version. |
---|
| 31 | % |
---|
| 32 | % ROMSTOOLS is distributed in the hope that it will be useful, but |
---|
| 33 | % WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
| 34 | % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
| 35 | % GNU General Public License for more details. |
---|
| 36 | % |
---|
| 37 | % You should have received a copy of the GNU General Public License |
---|
| 38 | % along with this program; if not, write to the Free Software |
---|
| 39 | % Foundation, Inc., 59 Temple Place, Suite 330, Boston, |
---|
| 40 | % MA 02111-1307 USA |
---|
| 41 | % |
---|
| 42 | % Copyright (c) 2005-2006 by Pierrick Penven |
---|
| 43 | % e-mail:Pierrick.Penven@ird.fr |
---|
| 44 | % |
---|
| 45 | % Updated 1-Sep-2006 by Pierrick Penven |
---|
| 46 | % Pierrick Penven, IRD, 2005. % |
---|
| 47 | % Olivier Aumont the master, IRD, 2006. % |
---|
| 48 | % Patricio Marchesiello, chief, IRD, 2007. % |
---|
| 49 | % Christophe Eugene Raoul Menkes, the slave, IRD, 2007. % |
---|
| 50 | |
---|
| 51 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
---|
| 52 | |
---|
| 53 | % WARNING !!!!!! THIS ASSUMES THAT THE TIME FOR PISCES INITIAL. |
---|
| 54 | % IS THE SAME AS THE CLIM T AND S. ELSE, CHANGE THE PROGRAM |
---|
| 55 | % |
---|
| 56 | clear all |
---|
| 57 | close all |
---|
| 58 | %%%%%%%%%%%%%%%%%%%%% USERS DEFINED VARIABLES %%%%%%%%%%%%%%%%%%%%%%%% |
---|
| 59 | % |
---|
| 60 | % Common parameters |
---|
| 61 | % |
---|
| 62 | romstools_param |
---|
| 63 | Roa; |
---|
| 64 | % |
---|
| 65 | % Set times and cycles: monthly climatology for all data |
---|
| 66 | % |
---|
| 67 | time=woa_time; % time |
---|
| 68 | cycle=woa_cycle; % cycle |
---|
| 69 | % |
---|
| 70 | % Data climatologies file names: |
---|
| 71 | % |
---|
| 72 | % |
---|
| 73 | no3_seas_data = [woapisces_dir,'no3_seas.cdf']; |
---|
| 74 | no3_ann_data = [woapisces_dir,'no3_ann.cdf']; |
---|
| 75 | po4_seas_data = [woapisces_dir,'po4_seas.cdf']; |
---|
| 76 | po4_ann_data = [woapisces_dir,'po4_ann.cdf']; |
---|
| 77 | o2_seas_data = [woapisces_dir,'o2_seas.cdf']; |
---|
| 78 | o2_ann_data = [woapisces_dir,'o2_ann.cdf']; |
---|
| 79 | sio3_seas_data = [woapisces_dir,'sio3_seas.cdf']; |
---|
| 80 | sio3_ann_data = [woapisces_dir,'sio3_ann.cdf']; |
---|
| 81 | dic_seas_data = [woapisces_dir,'dic_seas.cdf']; |
---|
| 82 | dic_ann_data = [woapisces_dir,'dic_ann.cdf']; |
---|
| 83 | talk_seas_data = [woapisces_dir,'talk_seas.cdf']; |
---|
| 84 | talk_ann_data = [woapisces_dir,'talk_ann.cdf']; |
---|
| 85 | doc_seas_data = [woapisces_dir,'doc_seas.cdf']; |
---|
| 86 | doc_ann_data = [woapisces_dir,'doc_ann.cdf']; |
---|
| 87 | fer_seas_data = [woapisces_dir,'fer_seas.cdf']; |
---|
| 88 | fer_ann_data = [woapisces_dir,'fer_ann.cdf']; |
---|
| 89 | dust_seas_data = [woapisces_dir,'dust_seas.cdf']; |
---|
| 90 | dust_ann_data = [woapisces_dir,'dust_ann.cdf']; |
---|
| 91 | % |
---|
| 92 | % |
---|
| 93 | %%%%%%%%%%%%%%%%%%% END USERS DEFINED VARIABLES %%%%%%%%%%%%%%%%%%%%%%% |
---|
| 94 | % |
---|
| 95 | % Title |
---|
| 96 | % |
---|
| 97 | disp(' ') |
---|
| 98 | disp([' Making the file: ',bryname]) |
---|
| 99 | disp([' Adding the PISCES variables']) |
---|
| 100 | disp(' ') |
---|
| 101 | disp([' Title: ',ROMS_title]) |
---|
| 102 | % |
---|
| 103 | % Read in the grid |
---|
| 104 | % |
---|
| 105 | disp(' ') |
---|
| 106 | disp(' Read in the grid...') |
---|
| 107 | nc=netcdf(grdname); |
---|
| 108 | lon=nc{'lon_rho'}(:); |
---|
| 109 | lat=nc{'lat_rho'}(:); |
---|
| 110 | Lp=length(nc('xi_rho')); |
---|
| 111 | Mp=length(nc('eta_rho')); |
---|
| 112 | hmax=max(max(nc{'h'}(:))); |
---|
| 113 | result=close(nc); |
---|
| 114 | % |
---|
| 115 | % Redefine the boundary file |
---|
| 116 | % |
---|
| 117 | if (makebry) |
---|
| 118 | disp(' ') |
---|
| 119 | disp(' Redefine the boundary file...') |
---|
| 120 | add_bry_pisces(bryname,obc,time,cycle,'write'); |
---|
| 121 | end |
---|
| 122 | % |
---|
| 123 | % Redefine the boundary file in Z-coordinates |
---|
| 124 | % |
---|
| 125 | if (makeZbry) |
---|
| 126 | disp(' ') |
---|
| 127 | disp(' Redefine the boundary Z-file...') |
---|
| 128 | % |
---|
| 129 | % get Z |
---|
| 130 | % |
---|
| 131 | nc=netcdf(no3_ann_data); |
---|
| 132 | Z=nc{'Z'}(:); |
---|
| 133 | kmax=max(find(Z<hmax))-1; |
---|
| 134 | Z=Z(1:kmax); |
---|
| 135 | close(nc) |
---|
| 136 | add_bry_pisces_Z(Zbryname,obc,Z,time,cycle,'write'); |
---|
| 137 | disp(' ') |
---|
| 138 | disp(' Horizontal extrapolations') |
---|
| 139 | % |
---|
| 140 | % Loop on the lateral boundaries |
---|
| 141 | % |
---|
| 142 | for obcndx=1:4 |
---|
| 143 | if obc(obcndx)==1 |
---|
| 144 | if obcndx==1 |
---|
| 145 | disp(' Processing southern boundary...') |
---|
| 146 | suffix='_south'; |
---|
| 147 | elseif obcndx==2 |
---|
| 148 | disp(' Processing eastern boundary...') |
---|
| 149 | suffix='_east'; |
---|
| 150 | elseif obcndx==3 |
---|
| 151 | disp(' Processing northern boundary...') |
---|
| 152 | suffix='_north'; |
---|
| 153 | elseif obcndx==4 |
---|
| 154 | disp(' Processing western boundary...') |
---|
| 155 | suffix='_west'; |
---|
| 156 | end |
---|
| 157 | disp(' Nitrate...') |
---|
| 158 | bry_interp_pisces(Zbryname,lon,lat,no3_seas_data,no3_ann_data,... |
---|
| 159 | 'nitrate',['NO3',suffix],obcndx,Roa); |
---|
| 160 | disp(' Phosphate...') |
---|
| 161 | bry_interp_pisces(Zbryname,lon,lat,po4_seas_data,po4_ann_data,... |
---|
| 162 | 'phosphate',['PO4',suffix],obcndx,Roa); |
---|
| 163 | disp(' Silicate...') |
---|
| 164 | bry_interp_pisces(Zbryname,lon,lat,sio3_seas_data,sio3_ann_data,... |
---|
| 165 | 'silicate',['Si',suffix],obcndx,Roa); |
---|
| 166 | disp(' Oxygen...') |
---|
| 167 | bry_interp_pisces(Zbryname,lon,lat,o2_seas_data,o2_ann_data,... |
---|
| 168 | 'oxygen',['O2',suffix],obcndx,Roa); |
---|
| 169 | disp(' Dissolved Inorganic Carbon...') |
---|
| 170 | bry_interp_pisces(Zbryname,lon,lat,dic_seas_data,dic_ann_data,... |
---|
| 171 | 'dic',['DIC',suffix],obcndx,Roa); |
---|
| 172 | disp(' Total Alkalinity...') |
---|
| 173 | bry_interp_pisces(Zbryname,lon,lat,talk_seas_data,talk_ann_data,... |
---|
| 174 | 'talk',['TALK',suffix],obcndx,Roa); |
---|
| 175 | disp(' Dissolved Organic Carbon...') |
---|
| 176 | bry_interp_pisces(Zbryname,lon,lat,doc_seas_data,doc_ann_data,... |
---|
| 177 | 'doc',['DOC',suffix],obcndx,Roa); |
---|
| 178 | disp(' Iron...') |
---|
| 179 | bry_interp_pisces(Zbryname,lon,lat,fer_seas_data,fer_ann_data,... |
---|
| 180 | 'fer',['FER',suffix],obcndx,Roa); |
---|
| 181 | end |
---|
| 182 | end |
---|
| 183 | end |
---|
| 184 | % |
---|
| 185 | % Vertical interpolations |
---|
| 186 | % |
---|
| 187 | if (makebry) |
---|
| 188 | disp(' ') |
---|
| 189 | disp(' Vertical interpolations') |
---|
| 190 | % |
---|
| 191 | % Loop on the lateral boundaries |
---|
| 192 | % |
---|
| 193 | for obcndx=1:4 |
---|
| 194 | if obc(obcndx)==1 |
---|
| 195 | if obcndx==1 |
---|
| 196 | disp(' Processing southern boundary...') |
---|
| 197 | suffix='_south'; |
---|
| 198 | elseif obcndx==2 |
---|
| 199 | disp(' Processing eastern boundary...') |
---|
| 200 | suffix='_east'; |
---|
| 201 | elseif obcndx==3 |
---|
| 202 | disp(' Processing northern boundary...') |
---|
| 203 | suffix='_north'; |
---|
| 204 | elseif obcndx==4 |
---|
| 205 | disp(' Processing western boundary...') |
---|
| 206 | suffix='_west'; |
---|
| 207 | end |
---|
| 208 | disp(' ') |
---|
| 209 | disp(' Nitrate...') |
---|
| 210 | vinterp_bry(bryname,grdname,Zbryname,['NO3',suffix],obcndx); |
---|
| 211 | disp(' ') |
---|
| 212 | disp(' Phosphate...') |
---|
| 213 | vinterp_bry(bryname,grdname,Zbryname,['PO4',suffix],obcndx); |
---|
| 214 | disp(' ') |
---|
| 215 | disp(' Silica...') |
---|
| 216 | vinterp_bry(bryname,grdname,Zbryname,['Si',suffix],obcndx); |
---|
| 217 | disp(' ') |
---|
| 218 | disp(' Oxygen ...') |
---|
| 219 | vinterp_bry(bryname,grdname,Zbryname,['O2',suffix],obcndx); |
---|
| 220 | disp(' ') |
---|
| 221 | disp(' Dissolved Inorganic Carbon...') |
---|
| 222 | vinterp_bry(bryname,grdname,Zbryname,['DIC',suffix],obcndx); |
---|
| 223 | disp(' ') |
---|
| 224 | disp(' Total Alkalinity...') |
---|
| 225 | vinterp_bry(bryname,grdname,Zbryname,['TALK',suffix],obcndx); |
---|
| 226 | disp(' ') |
---|
| 227 | disp(' Dissolved Organic Carbon...') |
---|
| 228 | vinterp_bry(bryname,grdname,Zbryname,['DOC',suffix],obcndx); |
---|
| 229 | disp(' ') |
---|
| 230 | disp(' Iron...') |
---|
| 231 | vinterp_bry(bryname,grdname,Zbryname,['FER',suffix],obcndx); |
---|
| 232 | end |
---|
| 233 | end |
---|
| 234 | end |
---|
| 235 | % |
---|
| 236 | % Make a few plots |
---|
| 237 | % |
---|
| 238 | if makeplot==1 |
---|
| 239 | disp(' ') |
---|
| 240 | disp(' Make a few plots...') |
---|
| 241 | test_bry(bryname,grdname,'NO3',1,obc) |
---|
| 242 | figure |
---|
| 243 | test_bry(bryname,grdname,'PO4',1,obc) |
---|
| 244 | figure |
---|
| 245 | test_bry(bryname,grdname,'Si',1,obc) |
---|
| 246 | figure |
---|
| 247 | test_bry(bryname,grdname,'O2',1,obc) |
---|
| 248 | figure |
---|
| 249 | test_bry(bryname,grdname,'DIC',6,obc) |
---|
| 250 | figure |
---|
| 251 | test_bry(bryname,grdname,'TALK',6,obc) |
---|
| 252 | figure |
---|
| 253 | test_bry(bryname,grdname,'DOC',6,obc) |
---|
| 254 | figure |
---|
| 255 | test_bry(bryname,grdname,'FER',6,obc) |
---|
| 256 | end |
---|
| 257 | % |
---|
| 258 | % End |
---|
| 259 | % |
---|
| 260 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
---|