Skip to content

Netcdf files with unexpected order of time, easting and northing coordinates. #1870

@ecor

Description

@ecor

Hi all,
I would like to open a nc file and process it with terra package (see header below) . The terra::rast function (default settings) does not recognize the easting and northing coordinates but it takes "time coordinate as one of the the two. I see generally that the coordinate order is expected to be "time, easting, northing" and not "easting ,northing ,time" . Are there some specific settings in order terra::rast can read correctly the spatiotemporal gridded variables? Thank you for your attention and suggestion.

Best
Emanuele @ecor

$ ncdump -h METEO_DATA_202003120000.NC 
netcdf METEO_DATA_202003120000 {
dimensions:
        time = 24 ;
        northing = 180 ;
        easting = 185 ;
variables:
        double time(time) ;
                time:standard_name = "time" ;
                time:units = "days since 2020-03-12T00:00:00+01:00" ;
        double northing(northing) ;
                northing:units = "m" ;
                northing:long_name = "Northing" ;
                northing:coordinate\ system = "CH1903 / LV03 (EPSG:21781)" ;
        double easting(easting) ;
                easting:units = "m" ;
                easting:long_name = "Easting" ;
                easting:coordinate\ system = "CH1903 / LV03 (EPSG:21781)" ;
        double lwrc(easting, northing, time) ;
                lwrc:_FillValue = -9999. ;
                lwrc:standard_name = "downwelling_longwave_flux_in_air" ;
                lwrc:long_name = "Incoming longwave radiation" ;
                lwrc:coverage_content_type = "modelResult" ;
                lwrc:units = "W m-2" ;
        double sdri(easting, northing, time) ;
                sdri:_FillValue = -9999. ;
                sdri:standard_name = "direct_downwelling_shortwave_flux_in_air" ;
                sdri:long_name = "Incoming direct shortwave radiation on inclined surface" ;
                sdri:coverage_content_type = "modelResult" ;
                sdri:units = "W m-2" ;
        double sdfd(easting, northing, time) ;
                sdfd:_FillValue = -9999. ;
                sdfd:standard_name = "diffuse_downwelling_shortwave_flux_in_air" ;
                sdfd:long_name = "Incoming diffuse shortwave radiation" ;
                sdfd:coverage_content_type = "modelResult" ;
                sdfd:units = "W m-2" ;
        double tais(easting, northing, time) ;
                tais:_FillValue = -9999. ;
                tais:units = "K" ;
                tais:standard_name = "air_temperature" ;
                tais:long_name = "Air temperature at 10 m above ground" ;
                tais:coverage_content_type = "modelResult" ;
        double rhus(easting, northing, time) ;
                rhus:_FillValue = -9999. ;
                rhus:units = "%" ;
                rhus:standard_name = "relative_humidity" ;
                rhus:long_name = "Relative humidity at 10 m above ground" ;
                rhus:coverage_content_type = "modelResult" ;
        double pail(easting, northing, time) ;
                pail:_FillValue = -9999. ;
                pail:units = "Pa" ;
                pail:standard_name = "air_pressure" ;
                pail:long_name = "Air pressure" ;
                pail:coverage_content_type = "modelResult" ;
        double wnsd(easting, northing, time) ;
                wnsd:_FillValue = -9999. ;
                wnsd:units = "m/s" ;
                wnsd:standard_name = "wind_speed" ;
                wnsd:long_name = "Wind speed at 10 m above ground" ;
                wnsd:coverage_content_type = "modelResult" ;
        double wndd(easting, northing, time) ;
                wndd:_FillValue = -9999. ;
                wndd:units = "deg" ;
                wndd:standard_name = "wind_from_direction" ;
                wndd:long_name = "Wind direction at 10 m above ground" ;
                wndd:coverage_content_type = "modelResult" ;
        double proi(easting, northing, time) ;
                proi:_FillValue = -9999. ;
                proi:units = "mm/hr" ;
                proi:standard_name = "precipitation_flux" ;
                proi:long_name = "Precipitation" ;
                proi:coverage_content_type = "modelResult" ;

// global attributes:
                :title = "High-resolution hydrometeorological data for the Dischma valley and surrounding areas in eastern Switzerland" ;
                :summary = "This dataset contains high-resolution meteorological input data useful for developing and testing physics-based snow and landsurface models. The dataset contains hourly data and has a spatial resolution of 100m and an extent of 18500 by 18000m." ;
                :keywords = "downwelling_longwave_flux_in_air; direct_downwelling_shortwave_flux_in_air; diffuse_downwelling_shortwave_flux_in_air; air_temperature; relative_humidity; air_pressure; wind_speed; wind_from_direction; precipitation_flux" ;
                :conventions = "ACDD 1-3; CF-1.11" ;
                :creator_name = "Jan Magnusson; Tobias Jonas" ;
                :creator_email = "[email protected]; [email protected]" ;
                :creator_url = "https://orcid.org/0000-0003-0257-1862; https://orcid.org/0000-0003-0386-8676" ;
                :institution = "WSL Institute for Snow and Avalanche Research SLF" ;
                :project = "International Network for Alpine Research Catchment Hydrology" ;
                :geospatial_lat_min = 46.6734987688503 ;
                :geospatial_lat_max = 46.8353396574981 ;
                :geospatial_lon_min = 9.74259474964444 ;
                :geospatial_lon_max = 9.98461064390458 ;
                :date_created = "2024-08-08T23:22:05" ;
                :history = "File created at 2024-08-08T23:22:05 using Matlab by Jan Magnusson" ;
}
(r-reticulate)


Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions