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

Incorrect forcing files using GLORYS12V1 data #16

Open
iris-keizer opened this issue Aug 15, 2022 · 5 comments
Open

Incorrect forcing files using GLORYS12V1 data #16

iris-keizer opened this issue Aug 15, 2022 · 5 comments

Comments

@iris-keizer
Copy link

iris-keizer commented Aug 15, 2022

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
Copy link
Author

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

@trondkr
Copy link
Owner

trondkr commented Aug 16, 2022 via email

@iris-keizer
Copy link
Author

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
Copy link
Author

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

@trondkr
Copy link
Owner

trondkr commented Oct 11, 2022 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants