diff --git a/Aforc_ERA5/README_ERA5.txt b/Aforc_ERA5/README_ERA5.txt index 78dc96d718724996354106dd2c092d5b3b4d64f7..a889315bebcffec3961ed4900dfa6949c2f5fd05 100644 --- a/Aforc_ERA5/README_ERA5.txt +++ b/Aforc_ERA5/README_ERA5.txt @@ -9,7 +9,7 @@ Here is a set of matlab and python routines allowing to : 3- ( Optional : If not using ONLINE_BULK capabilities) : create from these converted data at the ERA5 resolution, new CROCO "frc" and/or "blk" files (similar to CFSR ones) interpolated onto the croco grid ##################### ---> Pre-requisite : First the user need to install the ERA5 python API : https://cds.climate.copernicus.eu/api-how-to +--> Pre-requisite : First the user need to install the ERA5 python API : https://cds.climate.copernicus.eu/how-to-api --> Edit the era5_crocotools_param.py parameter file diff --git a/Aforc_ERA5/era5_crocotools_param_my.py b/Aforc_ERA5/era5_crocotools_param_my.py deleted file mode 100644 index c293036292ee8a909ded2d6f02ef2b206bd96b3e..0000000000000000000000000000000000000000 --- a/Aforc_ERA5/era5_crocotools_param_my.py +++ /dev/null @@ -1,86 +0,0 @@ -# -# For ERA5 python crocotools parameters list -# -# CAUTION IT MUST BE CONSISTENT with your MATLAB CROCOTOOLS_PARAM.m file in Run directory -# ******************************************************************************* -# U S E R * O P T I O N S -# ******************************************************************************* -# -# General path -# -config_dir = '/local/tmp/3/gcambon/CONFIGS/RUN_V2.0_cforec_LR_DEV/' # must be the same than crocotools_param -config_name = 'Benguela_LR' -# -# Original ERA5 directory -# -era5_dir_raw = config_dir + 'DATA/ERA5_native_' + config_name -# -# Output ERA5 directory -# -era5_dir_processed = config_dir + 'DATA/ERA5_' + config_name -# -# extraction wave variables -# -wave_extract=False # True to extract wave variables -# -# Dates limits -# -year_start = 2005 -month_start = 1 -year_end = 2005 -month_end = 1 -# -# Year origin of time -# -Yorig=2000 -# -# Overlapping days (at the beginning/end of each month) -# -n_overlap = 0 -# -# Request time (daily hours '00/01/.../23') -# -time = '00/01/02/03/04/05/06/07/08/09/10/11/12/13/14/15/16/17/18/19/20/21/22/23' -# -# Request variables (see available at ERA5_variables.json) -variables = ['lsm','tp','strd','ssr','t2m','q','u10','v10'] #note lsm is land_sea_mask -# -# Request area ([north, west, south, east]) -# -ownArea = 0 # 0 if area from a crocotools_param.m file - # 1 if own area - -if ownArea == 0: - # To complete if ownArea==0 - paramFile = config_dir + 'crocotools_param.m' # path the crocotools_param file of the simulation - -else: - # To complete if ownArea==1 - lonmin=7 - lonmax=23 - latmin=-45 - latmax=-20 -# -# Variable names and conversion coefficients -# TP: convert from accumlated m in a hour into kg m-2 s-1 -# -cff_tp=1000./3600. # m in 1 hour -> kg m-2 s-1 -# Heat flux J m-2 in one hour into W m-2 -# -cff_heat=1./3600. # J m-2 in 1 hour -> W m-2 -# Names, conversion coefficients and new units -# -variables = ['lsm' , 'sst' , 'tp' ,'strd' ,'ssr' ,'t2m' ,'q' ,'u10' ,'v10' ] -conv_cff = [1. , 1. , cff_tp ,cff_heat ,cff_heat ,1. ,1. ,1. ,1. ] -units = ['(0-1)', 'K' , 'kg m-2 s-1','W m-2' ,'W m-2' ,'K' ,'kg kg-1','m s-1','m s-1'] - -if wave_extract: - ## append waves variables - wave_var=['swh', 'mwd', 'pp1d' ,'cdww'];variables.extend(wave_var) - wave_conv_cff=[1., 1., 1. , 1.]; conv_cff.extend(wave_conv_cff) - wave_units=['m','Degrees true','s', 'dimensionless']; units.extend(wave_units) - - -# ******************************************************************************* -# E N D U S E R * O P T I O N S -# ******************************************************************************* diff --git a/CHANGELOG.md b/CHANGELOG.md index cda1eb226dc2a13a62b94f875aac9ef0ef1a4d97..e62c6b3a7a7c1556ba65f58449bd48069206f56e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,7 +8,10 @@ Release changelog are available here : https://gitlab.inria.fr/croco-ocean/croco ## Fixed -- Preprocessing_tools : fix in mexcdf functionality for matlab 20xx versions (in particular matlab 2024), see issue [#50](https://gitlab.inria.fr/croco-ocean/croco_tools/-/issues/50) +- Issue 50 : fix in mexcdf functionality for matlab 20xx versions (in particular matlab 2024) +- Issue 49, 43 : add GSHHS coastline dataset in m_map private directory +- Issue 44 : fix problem in editmask with longitude in 0-360° convention +- Issue 34 : fix redef and endef issue in Nesting tools + some cleaning in nestgui ## Changed diff --git a/Coupling_tools/CROCO/make_grid_from_WRF.m b/Coupling_tools/CROCO/make_grid_from_WRF.m index 413de464b6b7c9842dde018f24a6ea8f48f1ead8..3f22173147b0854f20b086e8074295a1c4449508 100644 --- a/Coupling_tools/CROCO/make_grid_from_WRF.m +++ b/Coupling_tools/CROCO/make_grid_from_WRF.m @@ -67,6 +67,12 @@ disp([' Title: ',CROCO_title]) disp(' ') disp([' Refine coefficient from WRF is : ',num2str(coef)]) +% +% Link the GSHHS coastline private data +% for crude, low, intermediate, high and full resolution +% +make_gshhs_link ; + % % Get the Longitude % @@ -296,7 +302,8 @@ if strcmp(r,'y') else editmask(croco_grd) end - r=input(' Finished with edit mask ? [press enter when finished]','s'); + disp(' Finished with Editmask? [press a key to finalize make_grid]'); + pause; end % close all diff --git a/Forecast_tools/CopernicusMarineToolbox/copernicusmarine_env.yml b/Forecast_tools/CopernicusMarineToolbox/copernicusmarine_env.yml deleted file mode 100644 index eebe6b1d06f86018b44c46b624f6b9f378e2a64b..0000000000000000000000000000000000000000 --- a/Forecast_tools/CopernicusMarineToolbox/copernicusmarine_env.yml +++ /dev/null @@ -1,8 +0,0 @@ -name: cmt_1.0 -channels: - - conda-forge -dependencies: - - pip - - pip: - - copernicusmarine>=1.0<=2.0 - - python>=3.9,<3.12 \ No newline at end of file diff --git a/Nesting_tools/create_nestedbulk.m b/Nesting_tools/create_nestedbulk.m index 2db1c3ffbb32332288b74c979fcc9e731ff0dff8..bb5b8ed6adbc7078e9d5942e2ec72d76b1d1808e 100644 --- a/Nesting_tools/create_nestedbulk.m +++ b/Nesting_tools/create_nestedbulk.m @@ -40,7 +40,7 @@ Lp=L+1; Mp=M+1; nw = netcdf(blkname, 'clobber'); -result = redef(nw); +%result = redef(nw); % % Create dimensions @@ -136,7 +136,7 @@ nw{'vwnd'}.long_name = 'v-wind'; nw{'vwnd'}.units = ncchar('meter second-1'); nw{'vwnd'}.units = 'm/s'; -result = endef(nw); +%result = endef(nw); % % Create global attributes diff --git a/Nesting_tools/create_nestedclim.m b/Nesting_tools/create_nestedclim.m index ace52e95a325f0f73eea18c9cec81dc9a246a850..9f38043d26bcf39cfe4bb7c32a5fb0d33e3a24e2 100644 --- a/Nesting_tools/create_nestedclim.m +++ b/Nesting_tools/create_nestedclim.m @@ -82,7 +82,7 @@ Np=N+1; type = 'CLIMATOLOGY file' ; history = 'CROCO' ; ncclim = netcdf(climfile,clobber); -result = redef(ncclim); +%result = redef(ncclim); % % Create dimensions % @@ -306,7 +306,7 @@ ncclim.history = history; % % Leave define mode % -result = endef(ncclim); +%result = endef(ncclim); % [s_rho,Cs_rho,s_w,Cs_w] = scoordinate(theta_s,theta_b,N,hc,vtransform); % diff --git a/Nesting_tools/create_nesteddust.m b/Nesting_tools/create_nesteddust.m index 78d9e852f834e7b3682362379734b22e44a67b41..ffb0ac733a7b001744d34f61932b524b11032a3f 100644 --- a/Nesting_tools/create_nesteddust.m +++ b/Nesting_tools/create_nesteddust.m @@ -37,7 +37,7 @@ close(nc); Lp=L+1; Mp=M+1; nw = netcdf(dustname, 'clobber'); -redef(nw); +%redef(nw); % % Create dimensions % @@ -70,7 +70,7 @@ nw{'dust'}.units = 'nmol Fe m-3'; nw{'dust'}.field = ncchar('Fe Dust Deposition, scalar, series'); nw{'dust'}.field = 'Fe Dust Deposition, scalar, series'; -endef(nw); +%endef(nw); % % Create global attributes diff --git a/Nesting_tools/create_nestedforcing.m b/Nesting_tools/create_nestedforcing.m index 231f928960ff1bba606861ee08e2d091f86f1e77..2a7c37ce43b9be1b5e189d2aa8724a1678401a8e 100644 --- a/Nesting_tools/create_nestedforcing.m +++ b/Nesting_tools/create_nestedforcing.m @@ -39,7 +39,7 @@ close(nc); Lp=L+1; Mp=M+1; nw = netcdf(frcname, 'clobber'); -redef(nw); +%redef(nw); % % Create dimensions % @@ -187,7 +187,7 @@ nw{'swrad'}.positive = 'downward flux, heating'; nw{'swrad'}.negative = ncchar('upward flux, cooling'); nw{'swrad'}.negative = 'upward flux, cooling'; -endef(nw); +%endef(nw); % % Create global attributes diff --git a/Nesting_tools/create_nestedgrid.m b/Nesting_tools/create_nestedgrid.m index de9064621efcaafd5f03b6d4b5f692b660a97e80..1b4af3c4acf3ae90bfaa3d61fe99bfbfdccd225e 100644 --- a/Nesting_tools/create_nestedgrid.m +++ b/Nesting_tools/create_nestedgrid.m @@ -36,7 +36,7 @@ Lp=L+1; Mp=M+1; % nw = netcdf(grdname, 'clobber'); -redef(nw); +%redef(nw); % % Create dimensions % @@ -275,7 +275,7 @@ nw{'mask_psi'}.option_0 = 'land'; nw{'mask_psi'}.option_1 = ncchar('water'); nw{'mask_psi'}.option_1 = 'water'; -endef(nw); +%endef(nw); % % Create global attributes diff --git a/Nesting_tools/create_nestedrestart.m b/Nesting_tools/create_nestedrestart.m index cdc87b2736d6f0bc84f04d9a5eeb94e4bad560bb..f785755bb6ec42d92ee2ce8587cb46dfc76bb9a8 100644 --- a/Nesting_tools/create_nestedrestart.m +++ b/Nesting_tools/create_nestedrestart.m @@ -69,7 +69,7 @@ ncprt=netcdf(parentfile,'nowrite'); type = 'restart file' ; history = 'CROCO' ; ncrst = netcdf(rstfile,clobber); -result = redef(ncrst); +%result = redef(ncrst); % % Create dimensions @@ -312,7 +312,7 @@ ncrst.CPPS=ncprt.CPPS(:); % % Leave define mode % -result = endef(ncrst); +%result = endef(ncrst); % % Fill variables % diff --git a/Nesting_tools/get_findgridpos.m b/Nesting_tools/get_findgridpos.m index 9e0712c77822dc65c2ee5b41657dd773700194e5..51e20bed83ab2a8d0f33a86096adc416ea374284 100644 --- a/Nesting_tools/get_findgridpos.m +++ b/Nesting_tools/get_findgridpos.m @@ -46,7 +46,7 @@ xy=get(gca,'currentpoint'); x=xy(1,1); y=xy(1,2); [lon1,lat1]=m_xy2ll(x,y); -rbbox +rbbox; xy=get(gca,'currentpoint'); x=xy(1,1); y=xy(1,2); diff --git a/Oforc_OGCM/Copernicus_Marine_Toolbox_installation.md b/Oforc_OGCM/Copernicus_Marine_Toolbox_installation.md index 3e99a2e225edb81e196dca467dcd4c49904e8316..7df71c84597c8f2e24ec42646e21da45dfd0cadd 100644 --- a/Oforc_OGCM/Copernicus_Marine_Toolbox_installation.md +++ b/Oforc_OGCM/Copernicus_Marine_Toolbox_installation.md @@ -4,50 +4,25 @@ The Copernicus Marine Toolbox is used to download and extract data from the Cope All the instructions can be found here : - * 1) https://help.marine.copernicus.eu/en/collections/4060068-copernicus-marine-toolbox - * 2) https://help.marine.copernicus.eu/en/articles/7970514-copernicus-marine-toolbox-installation +- Installation and update : https://help.marine.copernicus.eu/en/articles/7970514-copernicus-marine-toolbox-installation + +- Use : https://help.marine.copernicus.eu/en/collections/4060068-copernicus-marine-toolbox -Prerequisites: +## Prerequisites: * python version >= 3.9 & <3.12 ---- -## 2 ways to download it: - - 1) typing : - ```console - python -m pip install copernicusmarine - ``` - - - 2) Use of conda/mamba package (replace conda by mamba command below) - - * Install a dedicated environment, by default named cmt_1.0 . First, you need to copy the file copernicusmarine_env.yml from the directory Forecast_tools/CopernicusMarineToolbox/ - - ```console - conda env create -f copernicusmarine_env.yml - ``` - - Note that you can use micromamba instead of mamba to install the python environment - - - Firstly, you need to activate the environment cmt_1.0 : - - ```console - conda activate cmt_1.0 - ``` +## Location +The location of the executable (here after pathCMC) will be found typing : +```console +which copernicusmarine +``` - The location of the executable (here after pathCMC) will be found typing : +Note that the value returned by your terminal here, will be your pathCMC to fill in your crocotools_param.m and download_glorys_data.sh script - ```console - ls $CONDA_PREFIX/bin/copernicusmarine - ``` - Note that the value returned by your terminal here, will be your pathCMC to fill in your - crocotools_param.m and download_glorys_data.sh script ---- ## When it's installed : You will have access to the copernicusmarine executable with various sub-command, very useful to get, extract and download data from the Copernicus Marine Data Store : diff --git a/Oforc_OGCM/download_glorys_data.sh b/Oforc_OGCM/download_glorys_data.sh index 8b20c40a142649eef765cf9a5ea86858ecf95afb..d3fb6a0ad3510f4f4532731fc3fba249105dd058 100755 --- a/Oforc_OGCM/download_glorys_data.sh +++ b/Oforc_OGCM/download_glorys_data.sh @@ -4,9 +4,7 @@ set -e ########################## # python # ====== -# Type: -# python --version -# It should return: "Python 2.7.10+" or "Python 3.4+". +# python version >= 3.9 & <3.12 # # motuclient # ========== @@ -69,9 +67,9 @@ fi ## cmt info if [[ ${kdata} == "DAILY" ]]; then - product_id_reana='cmems_mod_glo_phy_my_0.083_P1D-m' + product_id_reana='cmems_mod_glo_phy_my_0.083_P1Ddeg-m' elif [[ ${kdata} == "MONTHLY" ]]; then - product_id_reana='cmems_mod_glo_phy_my_0.083_P1M-m' + product_id_reana='cmems_mod_glo_phy_my_0.083_P1Mdeg-m' else echo "Please specify what kind of data you want (DAILY or MONTHLY), exit...."; exit 1 fi diff --git a/Oforc_OGCM/get_file_python_mercator.m b/Oforc_OGCM/get_file_python_mercator.m index 1fe41bcf8da615bfdae7ddf7e8687642429499da..2a9dc6ea50f7d19b2ef531b95c2825c38b50f97b 100644 --- a/Oforc_OGCM/get_file_python_mercator.m +++ b/Oforc_OGCM/get_file_python_mercator.m @@ -54,8 +54,7 @@ command = { sprintf('export PYTHONWARNINGS="ignore"; ') sprintf(' -y %f -Y %f',geom(3),geom(4)) sprintf(' -z %f -Z %f',geom(5),geom(6)) sprintf(' -o ./') - sprintf(' -f %s',outname) - sprintf(' --force-download')}; + sprintf(' -f %s',outname)}; if isa(vars,'cell') for k =1:size(vars,2) diff --git a/Preprocessing_tools/create_bryfile_wkb.m b/Preprocessing_tools/create_bryfile_wkb.m index e26bade20314f23077286eaa1d47522075740456..1320ede33e3e32a10094e0524d446b7a56e6b818 100644 --- a/Preprocessing_tools/create_bryfile_wkb.m +++ b/Preprocessing_tools/create_bryfile_wkb.m @@ -58,9 +58,9 @@ M=Mp-1; % Create the boundary file % type = 'WKB BOUNDARY file' ; -history = 'ROMS' ; +history = 'CROCO' ; nc = netcdf(brywkbname,clobber); -result = redef(nc); +%result = redef(nc); % % Create dimensions % @@ -235,7 +235,7 @@ nc.history = history; % % Leave define mode % -result = endef(nc); +%result = endef(nc); % nc{'tstart'}(:) = min([min(time) min(time) min(time)]); nc{'tend'}(:) = max([max(time) max(time) max(time)]); diff --git a/Preprocessing_tools/make_grid.m b/Preprocessing_tools/make_grid.m index ac2692816537db2783ec70212b7b0a758e2b93fd..939048cf4b2bd058dd5ee15dd3ba9480feea1332 100644 --- a/Preprocessing_tools/make_grid.m +++ b/Preprocessing_tools/make_grid.m @@ -51,6 +51,12 @@ disp([' Title: ',CROCO_title]) disp(' ') disp([' Resolution: 1/',num2str(1/dl),' deg']) +% +% Link the GSHHS coastline private data +% for crude, low, intermediate, high and full resolution +% +make_gshhs_link ; + % % Choose interactive tool for making grid (rotated grid) % diff --git a/Preprocessing_tools/make_gshhs_link.m b/Preprocessing_tools/make_gshhs_link.m new file mode 100644 index 0000000000000000000000000000000000000000..11e10b49004ce906d529915035889ef33756e8fa --- /dev/null +++ b/Preprocessing_tools/make_gshhs_link.m @@ -0,0 +1,36 @@ +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% Link the GSHHS datasets : coastline (+ borders + rivers) +% at crude, low, intermediate, high and full resolution +% +% +% Updated February 2025 by Gildas Cambon +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +crocotools_param ; +warning off ; +isoctave=exist('octave_config_info'); + +r = 'n'; + +if (isoctave == 0) + disp(' ') + r = input([' Do you want to link the GSHHS data coastlines (+ borders and rivers) ? : ', COASTFILE_DIR, ... + '\n into m_map1.x private directory of CROCOTOOLS : ', CROCOTOOLS_dir, ... + 'UTILITIES/m_map1.4h/private/? y/[n] : '], 's'); +end + +if strcmp(r, 'y') + % + disp('') + disp([' Note : by default the m_map version 1.4h is considered.', ... + ' Adapt if needed with the version of m_map you use (1.4f, 1.4g, ..)']) + disp('...') + + if (isoctave == 0) + eval(['!ln -sf ', COASTFILE_DIR, '* ', CROCOTOOLS_dir, 'UTILITIES/m_map1.4h/private/']) + else + eval(['ln -sf ', COASTFILE_DIR, '* ', CROCOTOOLS_dir, 'UTILITIES/m_map1.4h/private/']) + end +end \ No newline at end of file diff --git a/UTILITIES/mask/ijcoast.m b/UTILITIES/mask/ijcoast.m index a562c6ce349fbc56bfb89c5ea4026cce01f2cac1..f93af4e890162b744e0d0cfab29f1fb3b428dfea 100644 --- a/UTILITIES/mask/ijcoast.m +++ b/UTILITIES/mask/ijcoast.m @@ -53,6 +53,18 @@ load(Cname); Clon=lon; Clat=lat; +%------------------------------------------------------------------------ +% Check if model is in -180 - 180 convention or in 0 - 360 convention +%------------------------------------------------------------------------- +indrlon180 = find(rlon > 180) ; +if ~isempty(indrlon180), % lon in 0 - 360° convention + disp('Switch from 0-360 to -180-180 for lon convention') + disp(' ') + rlon_new = mod(rlon + 180, 360) - 180; + rlon = rlon_new ; +end + + %----------------------------------------------------------------------- % Extract need coasline data. %----------------------------------------------------------------------- diff --git a/crocotools_param.m b/crocotools_param.m index a3538d7ae055db755bcde8c6918ff5fc644d4624..8b310ce1396cce28d18bf8d520efe0a23096ba96 100644 --- a/crocotools_param.m +++ b/crocotools_param.m @@ -194,6 +194,13 @@ topofile = [DATADIR,'Topo/etopo2.nc']; % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % +% +% GSHHS coastline user : add path to gshhs native private data) +% +COASTFILE_DIR = [DATADIR,'gshhs/']; +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% % 3 - Surface forcing parameters % used by make_forcing.m and by make_bulk.m % @@ -456,9 +463,9 @@ if strcmp(OGCM,'mercator') % ======================== kdata='MONTHLY' ; % DAILY or MONTHLY if strcmp(kdata,'DAILY') - product_id='cmems_mod_glo_phy_my_0.083_P1D-m'; + product_id='cmems_mod_glo_phy_my_0.083deg_P1D-m'; elseif strcmp(kdata,'MONTHLY') - product_id='cmems_mod_glo_phy_my_0.083_P1M-m'; + product_id='cmems_mod_glo_phy_my_0.083deg_P1M-m'; else disp('Please specify what kind of data you want (DAILY or MONTHLY)') end diff --git a/oct_start.m b/oct_start.m index efc2538b828a90b89cca9e56b190ac65218b403d..d16ae96dfe7fee495bde2aacc9dc14103d6d6fb7 100644 --- a/oct_start.m +++ b/oct_start.m @@ -47,7 +47,7 @@ addpath([myutilpath,'m_map1.4h']) addpath([myutilpath,'air_sea']) addpath([myutilpath,'mask']) % -% ROMSTOOLS directories +% CROCOTOOLS directories % addpath([tools_path,'Aforc_CFSR']) addpath([tools_path,'Aforc_ERA5'])