Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge Feature/met in master #24

Merged
merged 14 commits into from
Oct 19, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 47 additions & 0 deletions BUILD_CFG/SURFACE_FORCING/create_LSM.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@

from netCDF4 import Dataset
import numpy as np

coorfile = 'ERA5_MSL_y2013.nc' ## One ERA forcing file generated previously
maskfile = 'my_era5_LSM.nc' ## Land Sea Mask from ncks
outfile = 'ERA5_LSM.nc' ## Output file

#----------------------------------------------------------------------------

## READ SRC BATHYMETRY
#nc_c = Dataset( coorfile, 'r' )
#lon_src = nc_c.variables[ 'lon' ][:]
#lat_src = nc_c.variables[ 'lat' ][:]
#nc_c.close()
#print(coorfile, "loaded", lon_src.shape)

## READ SRC BATHYMETRY
nc_src = Dataset( maskfile, 'r' )
msk_src = nc_src.variables[ 'lsm' ][0,::-1] ## lat to be reverse as it was done in the generation of the forcing files
lat_src = nc_src.variables['latitude'][::-1]
lon_src = nc_src.variables['longitude'][:]
print(maskfile, "loaded", msk_src.shape)
#msk_src[(msk_src==0.)] = -1
#msk_src[(msk_src<1)] = -1
seas = msk_src < 0.5
land = msk_src >= 0.5
msk_src[seas] = -1
msk_src[land] = 1
nlat = msk_src.shape[0]
nlon = msk_src.shape[1]

## Edit the LSM as required
# E.g. FIX AN COASTAL POINT TO MAKE IT OCEAN.
# msk_src[20,19] = -1

## NETCDF OUTPUT
ncout = Dataset( outfile, 'w', format='NETCDF3_CLASSIC' )
ncout.createDimension( 'nlat', nlat )
ncout.createDimension( 'nlon', nlon )
lon = ncout.createVariable( 'lon', 'f4', ('nlat', 'nlon',), zlib='True' )
lat = ncout.createVariable( 'lat', 'f4', ('nlat', 'nlon',), zlib='True' )
lon[:] = np.broadcast_to(lon_src.reshape(1,nlon), (nlat,nlon))
lat[:] = np.broadcast_to(lat_src.reshape(nlat,1), (nlat,nlon))
bout = ncout.createVariable( "LSM", 'f4', ('nlat','nlon',), zlib='True', fill_value=-999. )
bout[:] = msk_src
ncout.close()
62 changes: 31 additions & 31 deletions BUILD_CFG/SURFACE_FORCING/namelist_reshape_bicubic_atmos
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,18 @@
nemo_lat: name of latitude variable in the coordinates.nc
/
&grid_inputs
input_file = '/work/n01/n01/acc/DFS/DFS5.2/1960/drowned_precip_DFS5.2_y1960.nc'
nemo_file = 'coordinates.nc'
input_file = './ERA5_MSL_y2013.nc'
nemo_file = './coordinates.nc'
datagrid_file = 'remap_data_grid_atmos.nc'
nemogrid_file = 'remap_nemo_grid_atmos.nc'
method = 'regular'
input_lon = 'lon0'
input_lat = 'lat0'
nemo_lon = 'glamt'
nemo_lat = 'gphit'
nemo_mask = 'none'
nemo_mask_value = 0
input_mask = 'none'
method = 'regular'
input_lon = 'lon'
input_lat = 'lat'
nemo_lon = 'glamt'
nemo_lat = 'gphit'
nemo_mask = 'none'
nemo_mask_value = 0
input_mask = 'none'
input_mask_value = 0
/
&comments
Expand All @@ -45,38 +45,38 @@
- output_opt may be supplied and set to either 'scrip' or 'ncar-csm'
/
&remap_inputs
num_maps = 1
grid1_file = 'remap_data_grid_atmos.nc'
grid2_file = 'remap_nemo_grid_atmos.nc'
interp_file1 = 'data_nemo_bicubic_atmos.nc'
interp_file2 = 'nemo_data_bicubic_atmos.nc'
map1_name = 'atmos to nemo bicubic Mapping'
map2_name = 'nemo to atmos bicubic Mapping'
map_method = 'bicubic'
num_maps = 1
grid1_file = 'remap_data_grid_atmos.nc'
grid2_file = 'remap_nemo_grid_atmos.nc'
interp_file1 = 'data_nemo_bicubic_atmos.nc'
interp_file2 = 'nemo_data_bicubic_atmos.nc'
map1_name = 'atmos to nemo bicubic Mapping'
map2_name = 'nemo to atmos bicubic Mapping'
map_method = 'bicubic'
normalize_opt = 'frac'
output_opt = 'scrip'
output_opt = 'scrip'
restrict_type = 'latitude'
num_srch_bins = 90
luse_grid1_area = .false.
luse_grid2_area = .false.
/
&interp_inputs
input_file = "nothing.nc"
interp_file = "data_nemo_bicubic_atmos.nc"
input_name = "nothing"
input_start = 1,1
input_file = "nothing.nc"
interp_file = "data_nemo_bicubic_atmos.nc"
input_name = "nothing"
input_start = 1,1
input_stride = 1,1
input_stop = 0,0
input_stop = 0,0
/

&interp_outputs
output_file = "nothing.nc"
output_mode = "create"
output_dims = 'x', 'y'
output_file = "nothing.nc"
output_mode = "create"
output_dims = 'x', 'y'
output_scaling = "topo|1.0"
output_name = 'topo'
output_lon = 'x'
output_lat = 'y'
output_name = 'topo'
output_lon = 'x'
output_lat = 'y'
/

&comments
Expand All @@ -86,6 +86,6 @@
/
&shape_inputs
interp_file = 'data_nemo_bicubic_atmos.nc'
output_file = 'weights_bicubic_atmos.nc'
output_file = 'weights_era5_SEVERN_bicubic.nc'
ew_wrap = -1
/
62 changes: 31 additions & 31 deletions BUILD_CFG/SURFACE_FORCING/namelist_reshape_bilin_atmos
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,18 @@
nemo_lat: name of latitude variable in the coordinates.nc
/
&grid_inputs
input_file = '/work/n01/n01/acc/DFS/DFS5.2/1960/drowned_precip_DFS5.2_y1960.nc'
nemo_file = 'coordinates.nc'
input_file = './ERA5_MSL_y2013.nc'
nemo_file = './coordinates.nc'
datagrid_file = 'remap_data_grid_atmos.nc'
nemogrid_file = 'remap_nemo_grid_atmos.nc'
method = 'regular'
input_lon = 'lon0'
input_lat = 'lat0'
nemo_lon = 'glamt'
nemo_lat = 'gphit'
nemo_mask = 'none'
nemo_mask_value = 0
input_mask = 'none'
method = 'regular'
input_lon = 'lon'
input_lat = 'lat'
nemo_lon = 'glamt'
nemo_lat = 'gphit'
nemo_mask = 'none'
nemo_mask_value = 0
input_mask = 'none'
input_mask_value = 0
/
&comments
Expand All @@ -45,38 +45,38 @@
- output_opt may be supplied and set to either 'scrip' or 'ncar-csm'
/
&remap_inputs
num_maps = 1
grid1_file = 'remap_data_grid_atmos.nc'
grid2_file = 'remap_nemo_grid_atmos.nc'
interp_file1 = 'data_nemo_bilin_atmos.nc'
interp_file2 = 'nemo_data_bilin_atmos.nc'
map1_name = 'atmos to nemo bilin Mapping'
map2_name = 'nemo to atmos bilin Mapping'
map_method = 'bilinear'
num_maps = 1
grid1_file = 'remap_data_grid_atmos.nc'
grid2_file = 'remap_nemo_grid_atmos.nc'
interp_file1 = 'data_nemo_bilin_atmos.nc'
interp_file2 = 'nemo_data_bilin_atmos.nc'
map1_name = 'atmos to nemo bilin Mapping'
map2_name = 'nemo to atmos bilin Mapping'
map_method = 'bilinear'
normalize_opt = 'frac'
output_opt = 'scrip'
output_opt = 'scrip'
restrict_type = 'latitude'
num_srch_bins = 90
luse_grid1_area = .false.
luse_grid2_area = .false.
/
&interp_inputs
input_file = "nothing.nc"
interp_file = "data_nemo_bilin_atmos.nc"
input_name = "nothing"
input_start = 1,1
input_file = "nothing.nc"
interp_file = "data_nemo_bilin_atmos.nc"
input_name = "nothing"
input_start = 1,1
input_stride = 1,1
input_stop = 0,0
input_stop = 0,0
/

&interp_outputs
output_file = "nothing.nc"
output_mode = "create"
output_dims = 'x', 'y'
output_file = "nothing.nc"
output_mode = "create"
output_dims = 'x', 'y'
output_scaling = "topo|1.0"
output_name = 'topo'
output_lon = 'x'
output_lat = 'y'
output_name = 'topo'
output_lon = 'x'
output_lat = 'y'
/

&comments
Expand All @@ -86,6 +86,6 @@
/
&shape_inputs
interp_file = 'data_nemo_bilin_atmos.nc'
output_file = 'weights_bilinear_atmos.nc'
output_file = 'weights_era5_SEVERN_bilin.nc'
ew_wrap = -1
/
35 changes: 35 additions & 0 deletions RUN_DIRECTORIES/EXP_barotropicTide_ERA5/context_nemo.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<!--
==============================================================================================
NEMO context
==============================================================================================
-->
<context id="nemo">
<!-- $id$ -->
<!-- Fields definition -->
<field_definition src="./field_def_nemo-oce.xml"/> <!-- NEMO ocean dynamics -->

<!-- Files definition -->
<file_definition src="./file_def_nemo-oce.xml"/> <!-- NEMO ocean dynamics -->
<!--
============================================================================================================
= grid definition = = DO NOT CHANGE =
============================================================================================================
-->

<axis_definition>
<axis id="deptht" long_name="Vertical T levels" unit="m" positive="down" />
<axis id="depthu" long_name="Vertical U levels" unit="m" positive="down" />
<axis id="depthv" long_name="Vertical V levels" unit="m" positive="down" />
<axis id="depthw" long_name="Vertical W levels" unit="m" positive="down" />
<axis id="nfloat" long_name="Float number" unit="-" />
<axis id="icbcla" long_name="Iceberg class" unit="1" />
<axis id="ncatice" long_name="Ice category" unit="1" />
<axis id="iax_20C" long_name="20 degC isotherm" unit="degC" />
<axis id="iax_28C" long_name="28 degC isotherm" unit="degC" />
</axis_definition>

<domain_definition src="./domain_def_nemo.xml"/>

<grid_definition src="./grid_def_nemo.xml"/>

</context>
79 changes: 79 additions & 0 deletions RUN_DIRECTORIES/EXP_barotropicTide_ERA5/file_def_nemo-oce.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
<?xml version="1.0"?>

<!--
============================================================================================================
= output files definition =
= Define your own files =
= put the variables you want... =
============================================================================================================
-->
<file_definition type="one_file" name="@expname@_@freq@" sync_freq="1d" min_digits="4">
<!--<file_definition type="multiple_file" name="@expname@_@freq@_@startdate@_@enddate@" sync_freq="1d" min_digits="4">-->

<file_group id="1ts" output_freq="1ts" output_level="10" enabled=".TRUE."> <!-- 1 time step files -->
<file id="file1" name_suffix="_t" description="1ts t-grid" enabled=".TRUE.">
<field field_ref="ssh" name="ssh" />
<field field_ref="sst" name="sst" />
</file>
<file id="file2" name_suffix="_u" description="1ts u-grid" enabled=".TRUE.">
<field field_ref="ubar" name="ubar" />
</file>
<file id="file3" name_suffix="_v" description="1ts v-grid" enabled=".TRUE.">
<field field_ref="vbar" name="vbar" />
</file>
</file_group>

<file_group id="3h" output_freq="3h" output_level="10" enabled=".TRUE."/> <!-- 3h files -->
<file_group id="2h" output_freq="2h" output_level="10" enabled=".TRUE."/> <!-- 2h files -->
<!-- <file id="file1" name_suffix="_2h" description="3d u and v output every 2 hours" enabled=".TRUE." >
<field field_ref="uoce_abs_max" name="uoce_abs_max" />
<field field_ref="voce_abs_max" name="voce_abs_max" />
</file>
</file_group>
-->

<file_group id="1h" output_freq="1h" output_level="10" enabled=".TRUE."> <!-- 1h files -->
<file id="file0" name_suffix="_t" description="1h mean t-grid" enabled=".TRUE.">
<field field_ref="ssh" name="ssh" />
</file>
</file_group>

<file_group id="6h" output_freq="6h" output_level="10" enabled=".TRUE."/> <!-- 6h files -->

<file_group id="4h" output_freq="4h" output_level="10" enabled=".TRUE."/>

<file_group id="1d" output_freq="1d" output_level="10" enabled=".TRUE."> <!-- 1d files -->
<!-- <file id="file1" name_suffix="_t" description="daily mean t-grid" split_freq="1mo" split_freq_format="%y%mo%d" enabled=".TRUE."> -->
<!--
<file id="file2" name_suffix="_t" description="daily mean t-grid" enabled=".TRUE.">
<field field_ref="ssh" name="ssh" />
</file>
<file id="file3" name_suffix="_u" description="daily mean u-grid" enabled=".TRUE.">
<field field_ref="ubar" name="ubar" />
</file>
<file id="file4" name_suffix="_v" description="daily mean v-grid" enabled=".TRUE.">
<field field_ref="vbar" name="vbar" />
</file>
-->
</file_group>

<file_group id="25h_mean" output_freq="1d" output_level="10" enabled=".TRUE."/> <!-- 3d files -->

<file_group id="5d" output_freq="5d" output_level="10" enabled=".TRUE."/> <!-- 5d files -->

<file_group id="1m" output_freq="1mo" output_level="10" enabled=".TRUE."/> <!-- real monthly files -->

<file_group id="2m" output_freq="2mo" output_level="10" enabled=".TRUE."/> <!-- real 2m files -->
<file_group id="3m" output_freq="3mo" output_level="10" enabled=".TRUE."/> <!-- real 3m files -->
<file_group id="4m" output_freq="4mo" output_level="10" enabled=".TRUE."/> <!-- real 4m files -->
<file_group id="6m" output_freq="6mo" output_level="10" enabled=".TRUE."/> <!-- real 6m files -->

<file_group id="1y" output_freq="1y" output_level="10" enabled=".TRUE."/> <!-- real yearly files -->
<file_group id="2y" output_freq="2y" output_level="10" enabled=".TRUE."/> <!-- real 2y files -->
<file_group id="5y" output_freq="5y" output_level="10" enabled=".TRUE."/> <!-- real 5y files -->
<file_group id="10y" output_freq="10y" output_level="10" enabled=".TRUE."/> <!-- real 10y files -->


</file_definition>


Loading