model2roms icon indicating copy to clipboard operation
model2roms copied to clipboard

Incorrect forcing files using GLORYS12V1 data

Open iris-keizer opened this issue 2 years ago • 5 comments

When I try to create forcing files using toolbox model2roms, the created forcing files don't seem to be correct. I've cloned the model2roms directory to my MacBook and changed the code to match my settings. Compiling and running the code works however the output does not seem to be correct (see figure init_forcing_zeta) compared to the input reanalysis (see figure glory_1993_15_01).

From the terminal log I think that the problem might be caused by the 'fillvalue'. However, I've tried many different values that I thought might be correct and this does not solve the problem.

What I see in the log is: Horizontal interpolation:N/A%|# So maybe the problem lies with the horizontal interpolation

Edit: this is because the package progressbar was not installed

Does anyone know what might cause the weird output here?

Below the images I pasted parts of the configM2R.py file that I've updated. I know only running for 2 months is very short but I'm now just running test cases to see if I've solved the problem.

terminal_log_2 terminal_log_1 glorys_1993_15_01_zos init_forcing_zeta
    return {'SODA': ['temperature', 'salinity', 'ssh', 'uvel', 'vvel'],
            'SODA3': ['temperature', 'salinity', 'ssh', 'uvel', 'vvel'],
            'SODA3_5DAY': ['temperature', 'salinity', 'ssh', 'uvel', 'vvel'],
            'GLORYS': ['temperature', 'salinity', 'ssh', 'uvel', 'vvel'],
            'WOAMONTHLY': ['temperature', 'salinity'],
            'NORESM': ['temperature', 'salinity', 'ssh', 'uvel', 'vvel', 'ageice', 'uice', 'vice', 'aice', 'hice',
                       'hs',
                       'O3_c', 'O3_TA', 'N1_p', 'N3_n', 'N5_s', 'O2_o']}[
        self.ocean_indata_type]

# Define the corresponding name of the variables in the input dataset files. This list needs to correspond
# exactly with the list given in the function define_global_varnames:
def define_input_data_varnames(self):
    return {'SODA3': ['temp', 'salt', 'ssh', 'u', 'v'],
            'SODA3_5DAY': ['temp', 'salt', 'ssh', 'u', 'v'],
            'GLORYS': ['thetao', 'so', 'zos', 'uo', 'vo'],
            'NORESM': ['templvl', 'salnlvl', 'sealv', 'uvellvl', 'vvellvl', 'iage', 'uvel', 'vvel', 'aice', 'hi',
                       'hs', 'dissic', 'talk', 'po4', 'no3', 'si', 'o2']}[self.ocean_indata_type]



# Define the path to where the  ROMS grid can be found
def define_roms_grid_path(self):
    try:
        return {'A20': '../oceanography/A20/Grid/A20niva_grd_v1.nc',
                'ROHO160': '../oceanography/NAUTILOS/Grid/norfjords_160m_grid.nc_A04.nc',
                'ROHO800': '../oceanography/ROHO800/Grid/ROHO800_grid_fix3.nc',
                'NS_test': 'NorthSea4_smooth01_sponge_nudg.nc'}[self.outgrid_name]
    except KeyError:
        return KeyError

# Define the abbreviation for the run, which is used to name output files etc.
def define_abbreviation(self):
    return {"A20": "a20",
            "Antarctic": "Antarctic",
            "ROHO160": "roho160",
            "ROHO800": "roho800",
            "NS_test": "NS_test",}[self.outgrid_name]

def define_ocean_forcing_data_path(self):
    try:
        return {'SODA3': "../oceanography/copernicus-marine-data/SODA3.4.2/",
                'SODA3_5DAY': "/Volumes/DATASETS/SODA2002/",  # "/cluster/projects/nn9297k/SODA3.3.2/",
                'NORESM': "/cluster/projects/nn9412k/A20/FORCING/RCP85_ocean/",
                'GLORYS': "/Users/iriskeizer/Documents/ROMS/code/model2roms3/forcing/"}[self.ocean_indata_type]
    except KeyError:
        return KeyError

    # IN GRIDTYPES ------------------------------------------------------------------------------
    # Define what grid type you want to interpolate from (input MODEL data)
    # Currently supported options:
    # 1. NORESM, 2. GLORYS, 3. SODA3, 4. SODA3_5DAY
    self.ocean_indata_type = 'GLORYS'
    self.atmos_indata_type = 'ERA5'

    # Define what grid type you wnat to interpolate from: Can be Z for SIGMA for ROMS
    # vertical coordinate system or ZLEVEL. also define the name of the dimensions in the input files.
    # Options:
    # 1. SIGMA (not properly implemented yet), 2. ZLEVEL
    self.ingrid_type = "ZLEVEL"  # "ZLEVEL"

    # Define the names of the geographical variables in the input files. These may
    # differ depending how the variable is located in a grid (e.g. Arakawa C grid - ROMS). In
    # SODA 3.3.1 the u and v location is defined by xu_ocean,  yu_ocean while temperature is
    # located in xt_ocean, yt_ocean.
    self.grd_type = 'regular'
    self.lon_name = "longitude"
    self.lat_name = "latitude"
    self.depth_name = "depth"
    self.lon_name_u = "longitude"
    self.lat_name_u = "latitude"
    self.lon_name_v = "longitude"
    self.lat_name_v = "latitude"

    if self.ocean_indata_type in ['SODA3_5DAY','SODA3']:
        self.lon_name = "xt_ocean"
        self.lat_name = "yt_ocean"
        self.depth_name = "st_ocean"
        self.lon_name_u = "xu_ocean"
        self.lat_name_u = "yu_ocean"
        self.lon_name_v = "xu_ocean"
        self.lat_name_v = "yu_ocean"
        self.time_object = []

    self.time_name = "time"
    self.realm = "ocean"
    self.fillvaluein = -32767

    # OUT GRIDTYPES ------------------------------------------------------------------------------
    # Define what grid type you want to interpolate to
    # Options: This is just the name of your grid used to identify your selection later
    self.outgrid_name = 'NS_test'  # "ROHO800", "A20", "ROHO160"
    self.outgrid_type = "ROMS"
    
    # Define number of output depth levels
    self.nlevels = 30
    # Define the grid stretching properties (leave default if uncertain what to pick)
    self.vstretching = 4
    self.vtransform = 2
    self.theta_s = 7.0
    self.theta_b = 2.0
    self.tcline = 50.0
    self.hc = 50.0


    # DATE AND TIME DETAILS ---------------------------------------------------------
    # Define the period to create forcing for
    self.start_year = 1993
    self.end_year = 1993
    self.start_month = 1
    self.end_month = 2
    self.start_day = 16
    self.end_day = 15

iris-keizer avatar Aug 15 '22 15:08 iris-keizer

If the problem has more to do with the grid, this is the grid file I'm using and the glorys input data.

Schermafbeelding 2022-08-16 om 13 09 51 Schermafbeelding 2022-08-16 om 13 12 10

iris-keizer avatar Aug 16 '22 11:08 iris-keizer

Your grid seems fine. Try to create the temperature field and see if that works to eliminate problems. T On 16 Aug 2022, 04:13 -0700, iris-keizer @.***>, wrote:

If the problem has more to do with the grid, this is the grid file I'm using and the glorys input data. — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you are subscribed to this thread.Message ID: @.***>

trondkr avatar Aug 16 '22 16:08 trondkr

These are the temperature fields for the init file. There seems to be something going wrong in the deep ocean near the continent edge.

Schermafbeelding 2022-08-18 om 10 21 22

iris-keizer avatar Aug 18 '22 08:08 iris-keizer

The problem might be caused by the fact that the ROMS grid is not really curvilinear as can be seen in the figures below.

Schermafbeelding 2022-08-18 om 12 36 46

The file PET0.ESMF_LogFile has output like this:

Schermafbeelding 2022-08-18 om 12 35 27

iris-keizer avatar Aug 18 '22 10:08 iris-keizer

Hi, I am not sure what happens here but the kind of patterns you get are often the result of extrapolating across large distances. GLORYS12V1 has been tested quite extensively with model2roms and should work, although ssh has not been tested as extensive as other variables. I am wondering if your grid is correctly setup with lon_rho and lat_rho ? Could you try to create forcing for temperature only, which by default should work if your grid is correct. Also, you can send me your grid and I can take a look after you have tested temperature. Cheers, Trond On 15 Aug 2022, 08:03 -0700, iris-keizer @.***>, wrote:

When I try to create forcing files using toolbox model2roms, the created forcing files don't seem to be correct. I've cloned the model2roms directory to my MacBook and changed the code to match my settings. Compiling and running the code works however the output does not seem to be correct (see figure init_forcing_zeta) compared to the input reanalysis (see figure glory_1993_15_01). From the terminal log I think that the problem might be caused by the 'fillvalue'. However, I've tried many different values that I thought might be correct and this does not solve the problem. Does anyone know what might cause the weird output here? Below the images I pasted parts of the configM2R.py file that I've updated. I know only running for 2 months is very short but I'm now just running test cases to see if I've solved the problem. return {'SODA': ['temperature', 'salinity', 'ssh', 'uvel', 'vvel'], 'SODA3': ['temperature', 'salinity', 'ssh', 'uvel', 'vvel'], 'SODA3_5DAY': ['temperature', 'salinity', 'ssh', 'uvel', 'vvel'], 'GLORYS': ['temperature', 'salinity', 'ssh', 'uvel', 'vvel'], 'WOAMONTHLY': ['temperature', 'salinity'], 'NORESM': ['temperature', 'salinity', 'ssh', 'uvel', 'vvel', 'ageice', 'uice', 'vice', 'aice', 'hice', 'hs', 'O3_c', 'O3_TA', 'N1_p', 'N3_n', 'N5_s', 'O2_o']}[ self.ocean_indata_type]

Define the corresponding name of the variables in the input dataset files. This list needs to correspond

exactly with the list given in the function define_global_varnames:

def define_input_data_varnames(self): return {'SODA3': ['temp', 'salt', 'ssh', 'u', 'v'], 'SODA3_5DAY': ['temp', 'salt', 'ssh', 'u', 'v'], 'GLORYS': ['thetao', 'so', 'zos', 'uo', 'vo'], 'NORESM': ['templvl', 'salnlvl', 'sealv', 'uvellvl', 'vvellvl', 'iage', 'uvel', 'vvel', 'aice', 'hi', 'hs', 'dissic', 'talk', 'po4', 'no3', 'si', 'o2']}[self.ocean_indata_type]

Define the path to where the ROMS grid can be found

def define_roms_grid_path(self): try: return {'A20': '../oceanography/A20/Grid/A20niva_grd_v1.nc', 'ROHO160': '../oceanography/NAUTILOS/Grid/norfjords_160m_grid.nc_A04.nc', 'ROHO800': '../oceanography/ROHO800/Grid/ROHO800_grid_fix3.nc', 'NS_test': 'NorthSea4_smooth01_sponge_nudg.nc'}[self.outgrid_name] except KeyError: return KeyError

Define the abbreviation for the run, which is used to name output files etc.

def define_abbreviation(self): return {"A20": "a20", "Antarctic": "Antarctic", "ROHO160": "roho160", "ROHO800": "roho800", "NS_test": "NS_test",}[self.outgrid_name]

def define_ocean_forcing_data_path(self): try: return {'SODA3': "../oceanography/copernicus-marine-data/SODA3.4.2/", 'SODA3_5DAY': "/Volumes/DATASETS/SODA2002/", # "/cluster/projects/nn9297k/SODA3.3.2/", 'NORESM': "/cluster/projects/nn9412k/A20/FORCING/RCP85_ocean/", 'GLORYS': "/Users/iriskeizer/Documents/ROMS/code/model2roms3/forcing/"}[self.ocean_indata_type] except KeyError: return KeyError

IN GRIDTYPES ------------------------------------------------------------------------------

Define what grid type you want to interpolate from (input MODEL data)

Currently supported options:

1. NORESM, 2. GLORYS, 3. SODA3, 4. SODA3_5DAY

self.ocean_indata_type = 'GLORYS' self.atmos_indata_type = 'ERA5'

Define what grid type you wnat to interpolate from: Can be Z for SIGMA for ROMS

vertical coordinate system or ZLEVEL. also define the name of the dimensions in the input files.

Options:

1. SIGMA (not properly implemented yet), 2. ZLEVEL

self.ingrid_type = "ZLEVEL" # "ZLEVEL"

Define the names of the geographical variables in the input files. These may

differ depending how the variable is located in a grid (e.g. Arakawa C grid - ROMS). In

SODA 3.3.1 the u and v location is defined by xu_ocean, yu_ocean while temperature is

located in xt_ocean, yt_ocean.

self.grd_type = 'regular' self.lon_name = "longitude" self.lat_name = "latitude" self.depth_name = "depth" self.lon_name_u = "longitude" self.lat_name_u = "latitude" self.lon_name_v = "longitude" self.lat_name_v = "latitude"

if self.ocean_indata_type in ['SODA3_5DAY','SODA3']: self.lon_name = "xt_ocean" self.lat_name = "yt_ocean" self.depth_name = "st_ocean" self.lon_name_u = "xu_ocean" self.lat_name_u = "yu_ocean" self.lon_name_v = "xu_ocean" self.lat_name_v = "yu_ocean" self.time_object = []

self.time_name = "time" self.realm = "ocean" self.fillvaluein = -32767

OUT GRIDTYPES ------------------------------------------------------------------------------

Define what grid type you want to interpolate to

Options: This is just the name of your grid used to identify your selection later

self.outgrid_name = 'NS_test' # "ROHO800", "A20", "ROHO160" self.outgrid_type = "ROMS"

Define number of output depth levels

self.nlevels = 30

Define the grid stretching properties (leave default if uncertain what to pick)

self.vstretching = 4 self.vtransform = 2 self.theta_s = 7.0 self.theta_b = 2.0 self.tcline = 50.0 self.hc = 50.0

DATE AND TIME DETAILS ---------------------------------------------------------

Define the period to create forcing for

self.start_year = 1993 self.end_year = 1993 self.start_month = 1 self.end_month = 2 self.start_day = 16 self.end_day = 15 — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you are subscribed to this thread.Message ID: @.***>

trondkr avatar Oct 11 '22 08:10 trondkr