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

Running with NetCDF forcing provider requires forcing data and start_time to be the same #451

Closed
mattw-nws opened this issue Oct 3, 2022 · 3 comments · Fixed by #457
Closed

Comments

@mattw-nws
Copy link
Contributor

NetCDF provider is returning wrong values for time values when the simulation start time is not the same as the forcing file start time.

Current behavior

When using "forcing":{"provider": "NetCDF"... and a start_time that does NOT equal the T0 time in the forcing file, the wrong data is returned for the wrong timesteps, effectively using the timestep index instead of the correct time value. CsvPerFeature does not exhibit this behavior.

Expected behavior

In the example below, the precip starting at 1700 (timestep 38) should start at 1400 (timestep 35) instead.

Steps to replicate behavior (include URLs)

  1. Use the following realization config, with the test data in data:
{
    "global": {
        "formulations": [
            {
                "name": "bmi_multi",
                "params": {
                    "model_type_name": "bmi_multi_noahowp_cfe",
                    "forcing_file": "",
                    "init_config": "",
                    "allow_exceed_end_time": true,
                    "main_output_variable": "Q_OUT",
                    "output_variables": ["APCP_surface","RAIN_RATE","Q_OUT"],
                    "modules": [
                        {
                            "name": "bmi_fortran",
                            "params": {
                                "model_type_name": "bmi_fortran_noahowp",
                                "library_file": "./extern/noah-owp-modular/cmake_build/libsurfacebmi.so",
                                "forcing_file": "",
                                "init_config": "./data/bmi/fortran/noah-owp-modular-init-{{id}}.namelist.input",
                                "allow_exceed_end_time": true,
                                "main_output_variable": "QINSUR",
                                "variables_names_map": {
                                    "PRCPNONC": "atmosphere_water__liquid_equivalent_precipitation_rate",
                                    "Q2": "atmosphere_air_water~vapor__relative_saturation",
                                    "SFCTMP": "land_surface_air__temperature",
                                    "UU": "land_surface_wind__x_component_of_velocity",
                                    "VV": "land_surface_wind__y_component_of_velocity",
                                    "LWDN": "land_surface_radiation~incoming~longwave__energy_flux",
                                    "SOLDN": "land_surface_radiation~incoming~shortwave__energy_flux",
                                    "SFCPRS": "land_surface_air__pressure"
                                },
                                "uses_forcing_file": false
                            }
                        },
                        {
                            "name": "bmi_c",
                            "params": {
                                "model_type_name": "bmi_c_cfe",
                                "library_file": "./extern/cfe/cmake_build/libcfebmi.so",
                                "forcing_file": "",
                                "init_config": "./data/bmi/c/cfe/{{id}}_bmi_config.ini",
                                "allow_exceed_end_time": true,
                                "main_output_variable": "Q_OUT",
                                "registration_function": "register_bmi_cfe",
                                "variables_names_map": {
                                    "water_potential_evaporation_flux": "ETRAN",
                                    "atmosphere_air_water~vapor__relative_saturation": "SPFH_2maboveground",
                                    "land_surface_air__temperature": "TMP_2maboveground",
                                    "land_surface_wind__x_component_of_velocity": "UGRD_10maboveground",
                                    "land_surface_wind__y_component_of_velocity": "VGRD_10maboveground",
                                    "land_surface_radiation~incoming~longwave__energy_flux": "DLWRF_surface",
                                    "land_surface_radiation~incoming~shortwave__energy_flux": "DSWRF_surface",
                                    "land_surface_air__pressure": "PRES_surface"
                                },
                                "uses_forcing_file": false
                            }
                        }
                    ],
                    "uses_forcing_file": false
                }
            }
        ],
        "forcing": {
            "path": "./data/forcing/cats-27_52_67-2015_12_01-2015_12_30.nc",
            "provider": "NetCDF"
        }
    },
    "time": {
        "start_time": "2015-12-01 03:00:00",
        "end_time": "2015-12-30 22:00:00",
        "output_interval": 3600
    }
}

and you will get incorrect data for the timesteps, e.g. cat-27 timestep 38:

38,2015-12-02 17:00:00,0.100000001,0.000100115,0.059517931

This should start at 1400, not 1700, which is timestep 38 in the forcing data...i.e. if you change the start_time above to "2015-12-01 00:00:00", it will produce:

38,2015-12-02 14:00:00,0.100000001,0.000100115,0.059517931

instead.

Screenshots

@stcui007
Copy link
Contributor

stcui007 commented Oct 3, 2022

Does running bmi_c_cfe model reproduce this behavior? I just want to test on a simpler model at the start.

@stcui007
Copy link
Contributor

stcui007 commented Oct 5, 2022

My output:
38,2015-12-02 17:00:00,0.100000001,0.000100115,0.046988432
Note the last number is different, maybe we are using different model?

@mattw-nws
Copy link
Contributor Author

The last column is Q_OUT, and if that output was produced with CFE only the result can definitely vary, as Noah will change the input that CFE receives.

Either way, the first two columns are relevant to the issue and it looks like you are reproducing it successfully.

mattw-nws added a commit to mattw-nws/ngen that referenced this issue Oct 17, 2022
mattw-nws added a commit to mattw-nws/ngen that referenced this issue Nov 9, 2022
@mattw-nws mattw-nws linked a pull request Nov 9, 2022 that will close this issue
11 tasks
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

Successfully merging a pull request may close this issue.

2 participants