-
Notifications
You must be signed in to change notification settings - Fork 44
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
How to import netCDF ROMS current in pygnome? #134
Comments
The error is stating that it is trying to create a L_Depth (level depth) object, when the correct type of object for this file would be a S_Depth (sigma layer depth) object. Unfortunately I haven't yet pinpointed what exactly is causing this misidentification, but I hope the explanation of the error helps. |
I believe the error can be circumvented by doing the following:
|
@jay-hennen Thanks for the advice. Unfortunately, the problem was not resolved.. and the following error message appears: Process finished with exit code 1" Is there any problem my NetCDF ROMS output file's variables name? Thank you. |
Dear all,
I want to input ROMS current data into pygnome.
I write this code,
`from gnome.movers import PyCurrentMover
print('adding a current mover:)
curr_file = get_datafile(os.path.join(base_dir,'ROMS_2021_avg_L1_0001.nc'))
model.movers += PyCurrentMover(curr_file)`
But, Error occured.
adding a current mover:
Traceback (most recent call last):
File "E:\Pygnome\Temp\script_Temp_Current\script_temp_current_rev.py", line 90, in
model = make_model()
File "E:\Pygnome\Temp\script_Temp_Current\script_temp_current_rev.py", line 71, in make_model
curr_file = PyCurrentMover(cf)
File "c:\users\ksh\pygnome\py_gnome\gnome\movers\py_current_movers.py", line 106, in init
self.current = GridCurrent.from_netCDF(filename=self.filename,
File "c:\users\ksh\pygnome\py_gnome\gnome\environment\gridded_objects_base.py", line 893, in from_netCDF
var.init_from_netCDF(*args, **kwargs)
File "c:\users\ksh\pygnome\py_gnome\gnome\environment\gridded_objects_base.py", line 831, in init_from_netCDF
depth = Depth.from_netCDF(grid_file=grid_file,
File "c:\users\ksh\pygnome\py_gnome\gnome\environment\gridded_objects_base.py", line 400, in from_netCDF
return gridded.depth.Depth.from_netCDF(*args, **kwargs)
File "C:\Users\KSH\anaconda3\envs\gnome\lib\site-packages\gridded\depth.py", line 677, in from_netCDF
cls = Depth._get_depth_type(df, depth_type, topology, _default_types)
File "C:\Users\KSH\anaconda3\envs\gnome\lib\site-packages\gridded\depth.py", line 725, in _get_depth_type
L_Depth.from_netCDF(dataset=dataset)
File "C:\Users\KSH\anaconda3\envs\gnome\lib\site-packages\gridded\depth.py", line 140, in from_netCDF
vname = cls._gen_varname(filename, dataset, [tn], [tln])
File "C:\Users\KSH\anaconda3\envs\gnome\lib\site-packages\gridded\depth.py", line 92, in _gen_varname
raise KeyError("Default names not found.")
KeyError: 'Default names not found.'
How can I fix this error?
ROMS NetCDF header is as follows:
// global attributes:
:file = "rst/L1/ROMS_2021_avg_L1_0001.nc";
:format = "netCDF-3 64bit offset file";
:Conventions = "CF-1.4, SGRID-0.3";
:type = "ROMS/TOMS nonlinear model averages file";
:title = "test07";
:var_info = "varinfo.dat";
:rst_file = "rst/L1/ROMS_2021_rst_L1.nc";
:his_base = "rst/L1/ROMS_2021_his_L1";
:avg_base = "rst/L1/ROMS_2021_avg_L1";
:grd_file = "grid_3min_7000m_smoothing4.nc";
:ini_file = "roms_ini_hycom_2021.nc";
:frc_file_01 = "roms_forcing_Pair_ERA5_2021.nc";
:frc_file_02 = "roms_forcing_Qair_ERA5_2021.nc";
:frc_file_03 = "roms_forcing_Tair_ERA5_2021.nc";
:frc_file_04 = "roms_forcing_rain_ERA5_2021.nc";
:frc_file_05 = "roms_forcing_swrad_ERA5_2021.nc";
:frc_file_06 = "roms_forcing_Uwind_ERA5_2021.nc";
:frc_file_07 = "roms_forcing_Vwind_ERA5_2021.nc";
:bry_file = "roms_bry_hycom_2021_daily.nc";
:script_file = "test07_2021.in";
:NLM_LBC = "\nEDGE: WEST SOUTH EAST NORTH \nzeta: Cha Cha Cha Cha \nubar: Fla Fla Fla Fla \nvbar: Fla Fla Fla Fla \nu: RadNud RadNud RadNud RadNud \nv: RadNud RadNud RadNud RadNud \ntemp: RadNud RadNud RadNud RadNud \nsalt: RadNud RadNud RadNud RadNud \ntke: Cha Cha Cha Cha";
:svn_url = "https://www.myroms.org/svn/src/trunk";
:svn_rev = "980";
:code_dir = "/home/snr-2019/ROMS/trunk";
:header_dir = "/data2/ROMS/2021_02-12";
:header_file = "test07.h";
:os = "Linux";
:cpu = "x86_64";
:compiler_system = "ifort";
:compiler_command = "/usr/local/mpi/intel18/mvapich2-2.2/bin/mpif90";
:compiler_flags = "-fp-model precise -heap-arrays -ip -O3 -traceback -check uninit";
:tiling = "010x010";
:history = "ROMS/TOMS, Version 3.8, Wednesday - September 21, 2022 - 10:38:00 PM";
:ana_file = "ROMS/Functionals/ana_btflux.h, ROMS/Functionals/ana_cloud.h, ROMS/Functionals/ana_tobc.h";
:CPP_options = "test07, ANA_BSFLUX, ANA_BTFLUX, ANA_CLOUD, ANA_TOBC, !ASSEMBLE_ALL..., ASSUMED_SHAPE, ATM_PRESS, AVERAGES, !BOUNDARY_A BULK_FLUXES, CANUTO_A !COLLECT_ALL..., CHARNOK, CRAIG_BANNER, CURVGRID, DIFF_GRID, DJ_GRADPS, DOUBLE_PRECISION, EMINUSP, GLS_MIXING, IMPLICIT_NUDGING, LIMIT_BSTRESS, LIMIT_STFLX_COOLING, KANTHA_CLAYSON, LONGWAVE, MASKING, MIX_ISO_TS, MIX_GEO_UV, MPI, NESTING, NONLINEAR, NONLIN_EOS, N2S2_HORAVG, ONE_WAY, PRESS_COMPENSATE, POWER_LAW, PROFILE, K_GSCHEME, REDUCE_ALLGATHER, RI_SPLINES, !RST_SINGLE, SALINITY, SOLAR_SOURCE, SOLVE3D, SPLINES_VDIFF, SPLINES_VVISC, TS_U3HADVECTION, TS_C4VADVECTION, TS_DIF4, UV_ADV, UV_COR, UV_U3HADVECTION, UV_C4VADVECTION, UV_LOGDRAG, UV_VIS4, VAR_RHO_2D, VISC_GRID";
:_CoordSysBuilder = "ucar.nc2.dataset.conv.CF1Convention";
}
The text was updated successfully, but these errors were encountered: