@@ -1779,39 +1779,34 @@ fn write_latlon_grid_section(out: &mut Vec<u8>, grid: &LatLonGrid) -> Result<()>
17791779}
17801780
17811781fn write_mercator_grid_section ( out : & mut Vec < u8 > , grid : & MercatorGrid ) -> Result < ( ) > {
1782- checked_projected_point_count (
1783- grid. core . nx ,
1784- grid. core . ny ,
1785- grid. core . number_of_points ,
1786- "Mercator grid" ,
1787- ) ?;
1782+ checked_projected_point_count ( grid. nx , grid. ny , grid. number_of_points , "Mercator grid" ) ?;
17881783
17891784 let mut section = vec ! [ 0u8 ; 72 ] ;
17901785 section[ ..4 ] . copy_from_slice ( & 72u32 . to_be_bytes ( ) ) ;
17911786 section[ 4 ] = 3 ;
1792- section[ 6 ..10 ] . copy_from_slice ( & grid. core . number_of_points . to_be_bytes ( ) ) ;
1787+ section[ 6 ..10 ] . copy_from_slice ( & grid. number_of_points . to_be_bytes ( ) ) ;
17931788 section[ 12 ..14 ] . copy_from_slice ( & 10u16 . to_be_bytes ( ) ) ;
17941789 write_projected_grid_shape_of_earth (
17951790 & mut section,
17961791 ProjectedGridShapeOfEarth {
1797- shape_of_earth : grid. core . shape_of_earth ,
1798- scale_factor_radius : grid. core . scale_factor_radius ,
1799- scaled_value_radius : grid. core . scaled_value_radius ,
1800- scale_factor_major_axis : grid. core . scale_factor_major_axis ,
1801- scaled_value_major_axis : grid. core . scaled_value_major_axis ,
1802- scale_factor_minor_axis : grid. core . scale_factor_minor_axis ,
1803- scaled_value_minor_axis : grid. core . scaled_value_minor_axis ,
1792+ shape_of_earth : grid. shape_of_earth ,
1793+ scale_factor_radius : grid. scale_factor_radius ,
1794+ scaled_value_radius : grid. scaled_value_radius ,
1795+ scale_factor_major_axis : grid. scale_factor_major_axis ,
1796+ scaled_value_major_axis : grid. scaled_value_major_axis ,
1797+ scale_factor_minor_axis : grid. scale_factor_minor_axis ,
1798+ scaled_value_minor_axis : grid. scaled_value_minor_axis ,
18041799 } ,
18051800 ) ;
1806- section[ 30 ..34 ] . copy_from_slice ( & grid. core . nx . to_be_bytes ( ) ) ;
1807- section[ 34 ..38 ] . copy_from_slice ( & grid. core . ny . to_be_bytes ( ) ) ;
1808- section[ 38 ..42 ] . copy_from_slice ( & encode_wmo_i32 ( grid. core . lat_first ) . ok_or_else ( || {
1801+ section[ 30 ..34 ] . copy_from_slice ( & grid. nx . to_be_bytes ( ) ) ;
1802+ section[ 34 ..38 ] . copy_from_slice ( & grid. ny . to_be_bytes ( ) ) ;
1803+ section[ 38 ..42 ] . copy_from_slice ( & encode_wmo_i32 ( grid. lat_first ) . ok_or_else ( || {
18091804 Error :: Other ( "latitude of first grid point does not fit GRIB signed i32" . into ( ) )
18101805 } ) ?) ;
1811- section[ 42 ..46 ] . copy_from_slice ( & encode_wmo_i32 ( grid. core . lon_first ) . ok_or_else ( || {
1806+ section[ 42 ..46 ] . copy_from_slice ( & encode_wmo_i32 ( grid. lon_first ) . ok_or_else ( || {
18121807 Error :: Other ( "longitude of first grid point does not fit GRIB signed i32" . into ( ) )
18131808 } ) ?) ;
1814- section[ 46 ] = grid. core . resolution_and_component_flags ;
1809+ section[ 46 ] = grid. resolution_and_component_flags ;
18151810 section[ 47 ..51 ] . copy_from_slice ( & encode_wmo_i32 ( grid. lat_d ) . ok_or_else ( || {
18161811 Error :: Other (
18171812 "latitude where grid lengths are specified does not fit GRIB signed i32" . into ( ) ,
@@ -1823,10 +1818,10 @@ fn write_mercator_grid_section(out: &mut Vec<u8>, grid: &MercatorGrid) -> Result
18231818 section[ 55 ..59 ] . copy_from_slice ( & encode_wmo_i32 ( grid. lon_last ) . ok_or_else ( || {
18241819 Error :: Other ( "longitude of last grid point does not fit GRIB signed i32" . into ( ) )
18251820 } ) ?) ;
1826- section[ 59 ] = grid. core . scanning_mode ;
1821+ section[ 59 ] = grid. scanning_mode ;
18271822 section[ 60 ..64 ] . copy_from_slice ( & grid. orientation_of_grid . to_be_bytes ( ) ) ;
1828- section[ 64 ..68 ] . copy_from_slice ( & grid. core . dx . to_be_bytes ( ) ) ;
1829- section[ 68 ..72 ] . copy_from_slice ( & grid. core . dy . to_be_bytes ( ) ) ;
1823+ section[ 64 ..68 ] . copy_from_slice ( & grid. dx . to_be_bytes ( ) ) ;
1824+ section[ 68 ..72 ] . copy_from_slice ( & grid. dy . to_be_bytes ( ) ) ;
18301825 out. extend_from_slice ( & section) ;
18311826 Ok ( ( ) )
18321827}
@@ -1836,46 +1831,46 @@ fn write_polar_stereographic_grid_section(
18361831 grid : & PolarStereographicGrid ,
18371832) -> Result < ( ) > {
18381833 checked_projected_point_count (
1839- grid. core . nx ,
1840- grid. core . ny ,
1841- grid. core . number_of_points ,
1834+ grid. nx ,
1835+ grid. ny ,
1836+ grid. number_of_points ,
18421837 "polar stereographic grid" ,
18431838 ) ?;
18441839
18451840 let mut section = vec ! [ 0u8 ; 65 ] ;
18461841 section[ ..4 ] . copy_from_slice ( & 65u32 . to_be_bytes ( ) ) ;
18471842 section[ 4 ] = 3 ;
1848- section[ 6 ..10 ] . copy_from_slice ( & grid. core . number_of_points . to_be_bytes ( ) ) ;
1843+ section[ 6 ..10 ] . copy_from_slice ( & grid. number_of_points . to_be_bytes ( ) ) ;
18491844 section[ 12 ..14 ] . copy_from_slice ( & 20u16 . to_be_bytes ( ) ) ;
18501845 write_projected_grid_shape_of_earth (
18511846 & mut section,
18521847 ProjectedGridShapeOfEarth {
1853- shape_of_earth : grid. core . shape_of_earth ,
1854- scale_factor_radius : grid. core . scale_factor_radius ,
1855- scaled_value_radius : grid. core . scaled_value_radius ,
1856- scale_factor_major_axis : grid. core . scale_factor_major_axis ,
1857- scaled_value_major_axis : grid. core . scaled_value_major_axis ,
1858- scale_factor_minor_axis : grid. core . scale_factor_minor_axis ,
1859- scaled_value_minor_axis : grid. core . scaled_value_minor_axis ,
1848+ shape_of_earth : grid. shape_of_earth ,
1849+ scale_factor_radius : grid. scale_factor_radius ,
1850+ scaled_value_radius : grid. scaled_value_radius ,
1851+ scale_factor_major_axis : grid. scale_factor_major_axis ,
1852+ scaled_value_major_axis : grid. scaled_value_major_axis ,
1853+ scale_factor_minor_axis : grid. scale_factor_minor_axis ,
1854+ scaled_value_minor_axis : grid. scaled_value_minor_axis ,
18601855 } ,
18611856 ) ;
1862- section[ 30 ..34 ] . copy_from_slice ( & grid. core . nx . to_be_bytes ( ) ) ;
1863- section[ 34 ..38 ] . copy_from_slice ( & grid. core . ny . to_be_bytes ( ) ) ;
1864- section[ 38 ..42 ] . copy_from_slice ( & encode_wmo_i32 ( grid. core . lat_first ) . ok_or_else ( || {
1857+ section[ 30 ..34 ] . copy_from_slice ( & grid. nx . to_be_bytes ( ) ) ;
1858+ section[ 34 ..38 ] . copy_from_slice ( & grid. ny . to_be_bytes ( ) ) ;
1859+ section[ 38 ..42 ] . copy_from_slice ( & encode_wmo_i32 ( grid. lat_first ) . ok_or_else ( || {
18651860 Error :: Other ( "latitude of first grid point does not fit GRIB signed i32" . into ( ) )
18661861 } ) ?) ;
1867- section[ 42 ..46 ] . copy_from_slice ( & grid. core . lon_first . to_be_bytes ( ) ) ;
1868- section[ 46 ] = grid. core . resolution_and_component_flags ;
1862+ section[ 42 ..46 ] . copy_from_slice ( & grid. lon_first . to_be_bytes ( ) ) ;
1863+ section[ 46 ] = grid. resolution_and_component_flags ;
18691864 section[ 47 ..51 ] . copy_from_slice ( & encode_wmo_i32 ( grid. lat_d ) . ok_or_else ( || {
18701865 Error :: Other (
18711866 "latitude where grid lengths are specified does not fit GRIB signed i32" . into ( ) ,
18721867 )
18731868 } ) ?) ;
18741869 section[ 51 ..55 ] . copy_from_slice ( & grid. lon_v . to_be_bytes ( ) ) ;
1875- section[ 55 ..59 ] . copy_from_slice ( & grid. core . dx . to_be_bytes ( ) ) ;
1876- section[ 59 ..63 ] . copy_from_slice ( & grid. core . dy . to_be_bytes ( ) ) ;
1870+ section[ 55 ..59 ] . copy_from_slice ( & grid. dx . to_be_bytes ( ) ) ;
1871+ section[ 59 ..63 ] . copy_from_slice ( & grid. dy . to_be_bytes ( ) ) ;
18771872 section[ 63 ] = grid. projection_center_flag ;
1878- section[ 64 ] = grid. core . scanning_mode ;
1873+ section[ 64 ] = grid. scanning_mode ;
18791874 out. extend_from_slice ( & section) ;
18801875 Ok ( ( ) )
18811876}
@@ -1885,46 +1880,46 @@ fn write_albers_equal_area_grid_section(
18851880 grid : & AlbersEqualAreaGrid ,
18861881) -> Result < ( ) > {
18871882 checked_projected_point_count (
1888- grid. core . nx ,
1889- grid. core . ny ,
1890- grid. core . number_of_points ,
1883+ grid. nx ,
1884+ grid. ny ,
1885+ grid. number_of_points ,
18911886 "Albers equal-area grid" ,
18921887 ) ?;
18931888
18941889 let mut section = vec ! [ 0u8 ; 81 ] ;
18951890 section[ ..4 ] . copy_from_slice ( & 81u32 . to_be_bytes ( ) ) ;
18961891 section[ 4 ] = 3 ;
1897- section[ 6 ..10 ] . copy_from_slice ( & grid. core . number_of_points . to_be_bytes ( ) ) ;
1892+ section[ 6 ..10 ] . copy_from_slice ( & grid. number_of_points . to_be_bytes ( ) ) ;
18981893 section[ 12 ..14 ] . copy_from_slice ( & 31u16 . to_be_bytes ( ) ) ;
18991894 write_projected_grid_shape_of_earth (
19001895 & mut section,
19011896 ProjectedGridShapeOfEarth {
1902- shape_of_earth : grid. core . shape_of_earth ,
1903- scale_factor_radius : grid. core . scale_factor_radius ,
1904- scaled_value_radius : grid. core . scaled_value_radius ,
1905- scale_factor_major_axis : grid. core . scale_factor_major_axis ,
1906- scaled_value_major_axis : grid. core . scaled_value_major_axis ,
1907- scale_factor_minor_axis : grid. core . scale_factor_minor_axis ,
1908- scaled_value_minor_axis : grid. core . scaled_value_minor_axis ,
1897+ shape_of_earth : grid. shape_of_earth ,
1898+ scale_factor_radius : grid. scale_factor_radius ,
1899+ scaled_value_radius : grid. scaled_value_radius ,
1900+ scale_factor_major_axis : grid. scale_factor_major_axis ,
1901+ scaled_value_major_axis : grid. scaled_value_major_axis ,
1902+ scale_factor_minor_axis : grid. scale_factor_minor_axis ,
1903+ scaled_value_minor_axis : grid. scaled_value_minor_axis ,
19091904 } ,
19101905 ) ;
1911- section[ 30 ..34 ] . copy_from_slice ( & grid. core . nx . to_be_bytes ( ) ) ;
1912- section[ 34 ..38 ] . copy_from_slice ( & grid. core . ny . to_be_bytes ( ) ) ;
1913- section[ 38 ..42 ] . copy_from_slice ( & encode_wmo_i32 ( grid. core . lat_first ) . ok_or_else ( || {
1906+ section[ 30 ..34 ] . copy_from_slice ( & grid. nx . to_be_bytes ( ) ) ;
1907+ section[ 34 ..38 ] . copy_from_slice ( & grid. ny . to_be_bytes ( ) ) ;
1908+ section[ 38 ..42 ] . copy_from_slice ( & encode_wmo_i32 ( grid. lat_first ) . ok_or_else ( || {
19141909 Error :: Other ( "latitude of first grid point does not fit GRIB signed i32" . into ( ) )
19151910 } ) ?) ;
1916- section[ 42 ..46 ] . copy_from_slice ( & grid. core . lon_first . to_be_bytes ( ) ) ;
1917- section[ 46 ] = grid. core . resolution_and_component_flags ;
1911+ section[ 42 ..46 ] . copy_from_slice ( & grid. lon_first . to_be_bytes ( ) ) ;
1912+ section[ 46 ] = grid. resolution_and_component_flags ;
19181913 section[ 47 ..51 ] . copy_from_slice ( & encode_wmo_i32 ( grid. lat_d ) . ok_or_else ( || {
19191914 Error :: Other (
19201915 "latitude where grid lengths are specified does not fit GRIB signed i32" . into ( ) ,
19211916 )
19221917 } ) ?) ;
19231918 section[ 51 ..55 ] . copy_from_slice ( & grid. lon_v . to_be_bytes ( ) ) ;
1924- section[ 55 ..59 ] . copy_from_slice ( & grid. core . dx . to_be_bytes ( ) ) ;
1925- section[ 59 ..63 ] . copy_from_slice ( & grid. core . dy . to_be_bytes ( ) ) ;
1919+ section[ 55 ..59 ] . copy_from_slice ( & grid. dx . to_be_bytes ( ) ) ;
1920+ section[ 59 ..63 ] . copy_from_slice ( & grid. dy . to_be_bytes ( ) ) ;
19261921 section[ 63 ] = grid. projection_center_flag ;
1927- section[ 64 ] = grid. core . scanning_mode ;
1922+ section[ 64 ] = grid. scanning_mode ;
19281923 section[ 65 ..69 ] . copy_from_slice (
19291924 & encode_wmo_i32 ( grid. latin1 ) . ok_or_else ( || {
19301925 Error :: Other ( "first Latin latitude does not fit GRIB signed i32" . into ( ) )
@@ -1946,46 +1941,46 @@ fn write_lambert_conformal_grid_section(
19461941 grid : & LambertConformalGrid ,
19471942) -> Result < ( ) > {
19481943 checked_projected_point_count (
1949- grid. core . nx ,
1950- grid. core . ny ,
1951- grid. core . number_of_points ,
1944+ grid. nx ,
1945+ grid. ny ,
1946+ grid. number_of_points ,
19521947 "Lambert conformal grid" ,
19531948 ) ?;
19541949
19551950 let mut section = vec ! [ 0u8 ; 81 ] ;
19561951 section[ ..4 ] . copy_from_slice ( & 81u32 . to_be_bytes ( ) ) ;
19571952 section[ 4 ] = 3 ;
1958- section[ 6 ..10 ] . copy_from_slice ( & grid. core . number_of_points . to_be_bytes ( ) ) ;
1953+ section[ 6 ..10 ] . copy_from_slice ( & grid. number_of_points . to_be_bytes ( ) ) ;
19591954 section[ 12 ..14 ] . copy_from_slice ( & 30u16 . to_be_bytes ( ) ) ;
19601955 write_projected_grid_shape_of_earth (
19611956 & mut section,
19621957 ProjectedGridShapeOfEarth {
1963- shape_of_earth : grid. core . shape_of_earth ,
1964- scale_factor_radius : grid. core . scale_factor_radius ,
1965- scaled_value_radius : grid. core . scaled_value_radius ,
1966- scale_factor_major_axis : grid. core . scale_factor_major_axis ,
1967- scaled_value_major_axis : grid. core . scaled_value_major_axis ,
1968- scale_factor_minor_axis : grid. core . scale_factor_minor_axis ,
1969- scaled_value_minor_axis : grid. core . scaled_value_minor_axis ,
1958+ shape_of_earth : grid. shape_of_earth ,
1959+ scale_factor_radius : grid. scale_factor_radius ,
1960+ scaled_value_radius : grid. scaled_value_radius ,
1961+ scale_factor_major_axis : grid. scale_factor_major_axis ,
1962+ scaled_value_major_axis : grid. scaled_value_major_axis ,
1963+ scale_factor_minor_axis : grid. scale_factor_minor_axis ,
1964+ scaled_value_minor_axis : grid. scaled_value_minor_axis ,
19701965 } ,
19711966 ) ;
1972- section[ 30 ..34 ] . copy_from_slice ( & grid. core . nx . to_be_bytes ( ) ) ;
1973- section[ 34 ..38 ] . copy_from_slice ( & grid. core . ny . to_be_bytes ( ) ) ;
1974- section[ 38 ..42 ] . copy_from_slice ( & encode_wmo_i32 ( grid. core . lat_first ) . ok_or_else ( || {
1967+ section[ 30 ..34 ] . copy_from_slice ( & grid. nx . to_be_bytes ( ) ) ;
1968+ section[ 34 ..38 ] . copy_from_slice ( & grid. ny . to_be_bytes ( ) ) ;
1969+ section[ 38 ..42 ] . copy_from_slice ( & encode_wmo_i32 ( grid. lat_first ) . ok_or_else ( || {
19751970 Error :: Other ( "latitude of first grid point does not fit GRIB signed i32" . into ( ) )
19761971 } ) ?) ;
1977- section[ 42 ..46 ] . copy_from_slice ( & grid. core . lon_first . to_be_bytes ( ) ) ;
1978- section[ 46 ] = grid. core . resolution_and_component_flags ;
1972+ section[ 42 ..46 ] . copy_from_slice ( & grid. lon_first . to_be_bytes ( ) ) ;
1973+ section[ 46 ] = grid. resolution_and_component_flags ;
19791974 section[ 47 ..51 ] . copy_from_slice ( & encode_wmo_i32 ( grid. lat_d ) . ok_or_else ( || {
19801975 Error :: Other (
19811976 "latitude where grid lengths are specified does not fit GRIB signed i32" . into ( ) ,
19821977 )
19831978 } ) ?) ;
19841979 section[ 51 ..55 ] . copy_from_slice ( & grid. lon_v . to_be_bytes ( ) ) ;
1985- section[ 55 ..59 ] . copy_from_slice ( & grid. core . dx . to_be_bytes ( ) ) ;
1986- section[ 59 ..63 ] . copy_from_slice ( & grid. core . dy . to_be_bytes ( ) ) ;
1980+ section[ 55 ..59 ] . copy_from_slice ( & grid. dx . to_be_bytes ( ) ) ;
1981+ section[ 59 ..63 ] . copy_from_slice ( & grid. dy . to_be_bytes ( ) ) ;
19871982 section[ 63 ] = grid. projection_center_flag ;
1988- section[ 64 ] = grid. core . scanning_mode ;
1983+ section[ 64 ] = grid. scanning_mode ;
19891984 section[ 65 ..69 ] . copy_from_slice (
19901985 & encode_wmo_i32 ( grid. latin1 ) . ok_or_else ( || {
19911986 Error :: Other ( "first Latin latitude does not fit GRIB signed i32" . into ( ) )
0 commit comments