diff --git a/tests/test_builders.py b/tests/test_builders.py index 47abda0..18ad55e 100644 --- a/tests/test_builders.py +++ b/tests/test_builders.py @@ -959,9 +959,449 @@ def test_parse_access_filename(builder, filename, expected): ["m2 s", "unitless"], ), ), + ( + builders.AccessOm4Builder, + "access-om4/output000/19000101.ice_daily.nc", + ( + "19000101.ice_daily.nc", + "XXXXXXXX_ice_daily", + "19000101", + "subhr", + "1900-01-01, 00:00:00", + "1900-01-01, 00:00:00", + [ + "siconc", + "sithick", + "average_T1", + "average_T2", + "average_DT", + "time_bnds", + ], + [ + "ice concentration", + "ice thickness", + "Start time for average period", + "End time for average period", + "Length of average period", + "time axis boundaries", + ], + ["", "", "", "", "", ""], + ["time: mean", "time: mean", "", "", "", ""], + [ + "0-1", + "m-ice", + "days since 1900-01-01 00:00:00", + "days since 1900-01-01 00:00:00", + "days", + "days", + ], + ), + ), + ( + builders.AccessOm4Builder, + "access-om4/output000/19000101.ocean_annual_z.nc", + ( + "19000101.ocean_annual_z.nc", + "XXXXXXXX_ocean_annual_z", + "19000101", + "subhr", + "1900-01-01, 00:00:00", + "1900-01-01, 00:00:00", + [ + "volcello", + "thetao", + "thetao_xyave", + "so", + "so_xyave", + "agessc", + "uo", + "vo", + "umo", + "vmo", + "uh", + "vh", + "T_adx", + "T_ady", + "S_adx", + "S_ady", + "average_T1", + "average_T2", + "average_DT", + "time_bnds", + ], + [ + "Ocean grid-cell volume", + "Sea Water Potential Temperature", + "Sea Water Potential Temperature", + "Sea Water Salinity", + "Sea Water Salinity", + "Ideal Age Tracer", + "Sea Water X Velocity", + "Sea Water Y Velocity", + "Ocean Mass X Transport", + "Ocean Mass Y Transport", + "Zonal Thickness Flux", + "Meridional Thickness Flux", + "Advective (by residual mean) Zonal Flux of Heat", + "Advective (by residual mean) Meridional Flux of Heat", + "Advective (by residual mean) Zonal Flux of Salt", + "Advective (by residual mean) Meridional Flux of Salt", + "Start time for average period", + "End time for average period", + "Length of average period", + "time axis boundaries", + ], + [ + "ocean_volume", + "sea_water_potential_temperature", + "sea_water_potential_temperature", + "sea_water_salinity", + "sea_water_salinity", + "ideal_age_tracer", + "sea_water_x_velocity", + "sea_water_y_velocity", + "ocean_mass_x_transport", + "ocean_mass_y_transport", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + ], + [ + "area:sum z_l:sum yh:sum xh:sum time: mean", + "area:mean z_l:mean yh:mean xh:mean time: mean", + "z_l:mean time: mean", + "area:mean z_l:mean yh:mean xh:mean time: mean", + "z_l:mean time: mean", + "area:mean z_l:mean yh:mean xh:mean time: mean", + "z_l:mean yh:mean xq:point time: mean", + "z_l:mean yq:point xh:mean time: mean", + "z_l:sum yh:sum xq:point time: mean", + "z_l:sum yq:point xh:sum time: mean", + "z_l:sum yh:sum xq:point time: mean", + "z_l:sum yq:point xh:sum time: mean", + "z_l:sum yh:sum xq:point time: mean", + "z_l:sum yq:point xh:sum time: mean", + "z_l:sum yh:sum xq:point time: mean", + "z_l:sum yq:point xh:sum time: mean", + "", + "", + "", + "", + ], + [ + "m3", + "degC", + "degC", + "psu", + "psu", + "yr", + "m s-1", + "m s-1", + "kg s-1", + "kg s-1", + "m3 s-1", + "m3 s-1", + "W", + "W", + "psu m3 s-1", + "psu m3 s-1", + "days since 1900-01-01 00:00:00", + "days since 1900-01-01 00:00:00", + "days", + "days", + ], + ), + ), + ( + builders.AccessOm4Builder, + "access-om4/output000/19000101.ocean_month_rho2.nc", + ( + "19000101.ocean_month_rho2.nc", + "XXXXXXXX_ocean_month_rho2", + "19000101", + "subhr", + "1900-01-01, 00:00:00", + "1900-01-01, 00:00:00", + [ + "volcello", + "thkcello", + "vmo", + "average_T1", + "average_T2", + "average_DT", + "time_bnds", + ], + [ + "Ocean grid-cell volume", + "Cell Thickness", + "Ocean Mass Y Transport", + "Start time for average period", + "End time for average period", + "Length of average period", + "time axis boundaries", + ], + [ + "ocean_volume", + "cell_thickness", + "ocean_mass_y_transport", + "", + "", + "", + "", + ], + [ + "area:sum rho2_l:sum yh:sum xh:sum time: mean", + "area:mean rho2_l:sum yh:mean xh:mean time: mean", + "rho2_l:sum yq:point xh:sum time: mean", + "", + "", + "", + "", + ], + [ + "m3", + "m", + "kg s-1", + "days since 1900-01-01 00:00:00", + "days since 1900-01-01 00:00:00", + "days", + "days", + ], + ), + ), + ( + builders.AccessOm4Builder, + "access-om4/output000/19000101.ocean_scalar_annual.nc", + ( + "19000101.ocean_scalar_annual.nc", + "XXXXXXXX_ocean_scalar_annual", + "19000101", + "subhr", + "1900-01-01, 00:00:00", + "1900-01-01, 00:00:00", + [ + "masso", + "volo", + "thetaoga", + "soga", + "sosga", + "average_T1", + "average_T2", + "average_DT", + "time_bnds", + ], + [ + "Mass of liquid ocean", + "Total volume of liquid ocean", + "Global Mean Ocean Potential Temperature", + "Global Mean Ocean Salinity", + "Sea Surface Salinity", + "Start time for average period", + "End time for average period", + "Length of average period", + "time axis boundaries", + ], + [ + "sea_water_mass", + "sea_water_volume", + "sea_water_potential_temperature", + "sea_water_salinity", + "sea_surface_salinity", + "", + "", + "", + "", + ], + [ + "time: mean", + "time: mean", + "time: mean", + "time: mean", + "time: mean", + "", + "", + "", + "", + ], + [ + "kg", + "m3", + "degC", + "psu", + "psu", + "days since 1900-01-01 00:00:00", + "days since 1900-01-01 00:00:00", + "days", + "days", + ], + ), + ), + ( + builders.AccessOm4Builder, + "access-om4/output000/19000101.ocean_static.nc", + ( + "19000101.ocean_static.nc", + "XXXXXXXX_ocean_static", + "19000101", + "fx", + "1900-01-01, 00:00:00", + "1900-01-01, 00:00:00", + [ + "areacello", + "deptho", + "hfgeou", + "sftof", + "Coriolis", + "geolon", + "geolat", + "geolon_c", + "geolat_c", + "geolon_u", + "geolat_u", + "geolon_v", + "geolat_v", + "wet", + "wet_c", + "wet_u", + "wet_v", + "dxt", + "dyt", + "dxCu", + "dyCu", + "dxCv", + "dyCv", + "areacello_cu", + "areacello_cv", + "areacello_bu", + ], + [ + "Ocean Grid-Cell Area", + "Sea Floor Depth", + "Upward geothermal heat flux at sea floor", + "Sea Area Fraction", + "Coriolis parameter at corner (Bu) points", + "Longitude of tracer (T) points", + "Latitude of tracer (T) points", + "Longitude of corner (Bu) points", + "Latitude of corner (Bu) points", + "Longitude of zonal velocity (Cu) points", + "Latitude of zonal velocity (Cu) points", + "Longitude of meridional velocity (Cv) points", + "Latitude of meridional velocity (Cv) points", + "0 if land, 1 if ocean at tracer points", + "0 if land, 1 if ocean at corner (Bu) points", + "0 if land, 1 if ocean at zonal velocity (Cu) points", + "0 if land, 1 if ocean at meridional velocity (Cv) points", + "Delta(x) at thickness/tracer points (meter)", + "Delta(y) at thickness/tracer points (meter)", + "Delta(x) at u points (meter)", + "Delta(y) at u points (meter)", + "Delta(x) at v points (meter)", + "Delta(y) at v points (meter)", + "Ocean Grid-Cell Area", + "Ocean Grid-Cell Area", + "Ocean Grid-Cell Area", + ], + [ + "cell_area", + "sea_floor_depth_below_geoid", + "upward_geothermal_heat_flux_at_sea_floor", + "SeaAreaFraction", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "cell_area", + "cell_area", + "cell_area", + ], + [ + "area:sum yh:sum xh:sum time: point", + "area:mean yh:mean xh:mean time: point", + "area:mean yh:mean xh:mean time: point", + "area:mean yh:mean xh:mean time: point", + "time: point", + "time: point", + "time: point", + "time: point", + "time: point", + "time: point", + "time: point", + "time: point", + "time: point", + "time: point", + "time: point", + "time: point", + "time: point", + "time: point", + "time: point", + "time: point", + "time: point", + "time: point", + "time: point", + "area:sum yh:sum xq:sum time: point", + "area:sum yq:sum xh:sum time: point", + "area:sum yq:sum xq:sum time: point", + ], + [ + "m2", + "m", + "W m-2", + "%", + "s-1", + "degrees_east", + "degrees_north", + "degrees_east", + "degrees_north", + "degrees_east", + "degrees_north", + "degrees_east", + "degrees_north", + "", + "", + "", + "", + "m", + "m", + "m", + "m", + "m", + "m", + "m2", + "m2", + "m2", + ], + ), + ), ], ) def test_parse_access_ncfile(test_data, builder, filename, expected): file = str(test_data / Path(filename)) assert builder.parse_access_ncfile(file) == expected + + # TODO this can be expanded to check each output line against + # the opened file, i.e. check for correctness as well as + # regression