Skip to content
GitLab
Projects Groups Topics Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Sign in
  • startR startR
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributor statistics
    • Graph
    • Compare revisions
  • Issues 29
    • Issues 29
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 6
    • Merge requests 6
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Artifacts
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Earth SciencesEarth Sciences
  • startRstartR
  • Issues
  • #67
Closed
Open
Issue created Aug 10, 2020 by aho@ahoMaintainer

Start(): return_vars of latitude and longitude is wrong when transformation

The problem happens when transformation is applied and return_vars = list(longitude = NULL, latitude = NULL). The following two scripts return the same values of the variable, but the longitude attributes are different. The first script is correct.

Correct. longitude attribute follows 'longitude_reorder', [-180, 180].

  repos <- "/esarchive/exp/ecmwf/system5_m1/monthly_mean/$var$_f6h/$var$_$sdate$.nc"
  var <- 'tas'
  sdate <- c('20170101')
  lon.min <- 0
  lon.max <- 359.9
  lat.min <- -90
  lat.max <- 90

  data2 <- Start(dat = repos,
                var = var,
                sdate = sdate,
                ensemble = indices(1),
                time = indices(1),
                latitude = values(list(lat.min, lat.max)),
                latitude_reorder = Sort(),
                longitude = values(list(lon.min, lon.max)),
                longitude_reorder = CircularSort(-180, 180),
                transform = CDORemapper,
                transform_extra_cells = 2,
                transform_params = list(grid = 'r360x181',
                                        method = 'conservative',
                                        crop = c(lon.min, lon.max,
                                                 lat.min, lat.max)),
                transform_vars = c('latitude', 'longitude'),
                synonims = list(latitude = c('lat', 'latitude'),
                             longitude = c('lon', 'longitude')),
                return_vars = list(time = 'sdate',
                                   longitude = 'dat',
                                   latitude = 'dat'),
                retrieve = T)

asd <- ClimProjDiags::Subset(data2, c(1,2,3,4,5), list(1,1,1,1,1), drop = 'selected')
lat <- attr(asd, 'Variable')$dat1$latitude
lon <- attr(asd, 'Variable')$dat1$longitude
s2dverification::PlotEquiMap(asd, lon, lat)

correct_map

Wrong. Longitude attribute should be [-180, 180], not [0, 360]

  data <- Start(dat = repos,
                var = var,
                sdate = sdate,
                ensemble = indices(1),
                time = indices(1),
                latitude = values(list(lat.min, lat.max)),
                latitude_reorder = Sort(),
                longitude = values(list(lon.min, lon.max)),
                longitude_reorder = CircularSort(-180, 180),
                transform = CDORemapper,
                transform_extra_cells = 2,
                transform_params = list(grid = 'r360x181',
                                        method = 'conservative',
                                        crop = c(lon.min, lon.max,
                                                 lat.min, lat.max)),
                transform_vars = c('latitude', 'longitude'),
                synonims = list(latitude = c('lat', 'latitude'),
                             longitude = c('lon', 'longitude')),
                return_vars = list(time = 'sdate',
                                   longitude = NULL,
                                   latitude = NULL),
                retrieve = T
               )

qwe <- ClimProjDiags::Subset(data, c(1,2,3,4,5), list(1,1,1,1,1), drop = 'selected')
lat2 <- attr(qwe, 'Variable')$common$latitude
lon2 <- attr(qwe, 'Variable')$common$longitude
s2dverification::PlotEquiMap(qwe, lon2, lat2)

wrong_map

Assignee
Assign to
Time tracking