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 7
    • Merge requests 7
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • 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
  • #160
Closed
Open
Issue created Sep 06, 2022 by vagudets@vagudetsMaintainer

Start(): "Error in easyNCDF::ArrayToNc (...) The dimension 'longitude' is defined or used more than once in the provided data but the dimension specifications do not match."

Hi @aho

As we discussed earlier today and in auto-s2s#35, there are certain situation where startR returns an error when trying to load and regrid data with the longitude range [0, 359].

Below is an example:

library(startR)
lats.min <- 0
lats.max <- 10
lons.min <- 0
lons.max <- 359
circular.sort <- CircularSort(0, 360)
obs.path <- '/esarchive/recon/ecmwf/era5/monthly_mean/$var$_f1h-r1440x721cds/$var$_$file_date$.nc'
file_date <- paste0(as.character(c(2012:2016)), '05')
variable <- "tas"

obs <- Start(dat = obs.path,
             var = variable,
             file_date = file_date,
             latitude = values(list(lats.min, lats.max)),
             latitude_reorder = Sort(),
             longitude = values(list(lons.min, lons.max)),
             longitude_reorder = circular.sort,
             transform = CDORemapper,
             transform_params = list(grid = 'r360x180',
                                     method = 'bilinear'),
             transform_vars = c('latitude', 'longitude'),
             synonims = list(latitude = c('lat','latitude'),
                             longitude = c('lon','longitude')),
             return_vars = list(latitude = 'dat',
                                longitude = 'dat',
                                time = 'file_date'),
             retrieve = TRUE)

The above code results in the following error message:

* Detected dimension sizes:
*         dat:   1
*         var:   1
*   file_date:   5
*    latitude:  10
*   longitude: 360
* Total size of requested data:
*   1 x 1 x 5 x 10 x 360 x 8 bytes = 140.6 Kb
* If the size of the requested data is close to or above the free shared
*   RAM memory, R may crash.
* If the size of the requested data is close to or above the half of the
*   free RAM memory, R may crash.
* Will now proceed to read and process 5 data files:
*   /esarchive/recon/ecmwf/era5/monthly_mean/tas_f1h-r1440x721cds/tas_201205.nc
*   /esarchive/recon/ecmwf/era5/monthly_mean/tas_f1h-r1440x721cds/tas_201305.nc
*   /esarchive/recon/ecmwf/era5/monthly_mean/tas_f1h-r1440x721cds/tas_201405.nc
*   /esarchive/recon/ecmwf/era5/monthly_mean/tas_f1h-r1440x721cds/tas_201505.nc
*   /esarchive/recon/ecmwf/era5/monthly_mean/tas_f1h-r1440x721cds/tas_201605.nc
* Loading... This may take several minutes...
* Progress: 0%Error in easyNCDF::ArrayToNc(setNames(list(data_array, lons, lats), c("var",  : 
  The dimension 'longitude' is defined or used more than once in the provided data but the dimension specifications do not match.

The same Start() calls work for smaller longitude ranges (e.g. [0, 358]) or for longitude ranges that are close enough to the full 360 lon range (e.g. [0, 359.9]).

In fact, it works well for lons.max = 359.75 or greater. In this case, the original grid is 0.25x0.25. So it seems to me like the problem appears when:

a) The whole range of longitudes is requested, AND

b) The difference between the edge of the longitude range and the value of lons.max is greater than the longitudinal resolution of the grid.

Please let me know if anything I said wasn't clear enough.

Thanks,

Victòria

Edited Sep 06, 2022 by vagudets
Assignee
Assign to
Time tracking