Skip to content
GitLab
Projects Groups Topics Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Sign in
  • s2dv s2dv
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributor statistics
    • Graph
    • Compare revisions
  • Issues 17
    • Issues 17
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 2
    • Merge requests 2
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Terraform modules
  • 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
  • s2dvs2dv
  • Issues
  • #114
Closed
Open
Issue created Jan 10, 2024 by Eva Rifà@erifarovMaintainer

Error in CDORemap interpolation from an irregular grid into a gaussian grid

Hi @vagudets,

I tag you to let you know about this issue. While I am taking a look, I'll inform you about the progress.

Summary

While running the examples with different R versions I have identified some problems in the function. There are some examples in the CDORemap documentation that don't work. They are the ones regarding interpolation from an irregular grid onto a gaussian grid.

Example

# Example (1):
# An example of an interpolation from an irregular grid onto a gaussian grid
num_lats <- 25
num_lons <- 50
tas <- array(1:(10*num_lats*10*num_lons*10), 
             dim = c(10, num_lats, 10, num_lons))
names(dim(tas)) <- c('a', 'j', 'b', 'i')
lon <- array(seq(0, 360 - 360/num_lons, length.out = num_lons), 
             dim = c(num_lons, num_lats))
metadata <- list(lon = list(units = 'degrees_east'))
names(dim(lon)) <- c('i', 'j')
attr(lon, 'variables') <- metadata
lat <- t(array(seq(-90, 90, length.out = num_lats), 
         dim = c(num_lats, num_lons)))
metadata <- list(lat = list(units = 'degrees_north'))
names(dim(lat)) <- c('i', 'j')
attr(lat, 'variables') <- metadata
tas2 <- CDORemap(tas, lon, lat, 't17grid', 'bil') 

# Error message (1) on HUB

sh: line 1: 4150195 Aborted                 (core dumped) cdo -s sellonlatbox,-3.6,356.4,-90,90 -remapbil,t17grid /tmp/RtmpFUgR3R/R_CDORemap_3f53895c6f9816.nc /tmp/RtmpFUgR3R/R_CDORemap_3f53892e390bdc.nc > /dev/null 2> /dev/null
Error in CDORemap(tas, lon, lat, "t17grid", "bil") : 
  CDO remap failed. Possible problem: parameter 'grid'.
In addition: Warning message:
! Warning: CDORemap: Using CDO version 2.0.6. 

# Error message (1) on WS

Error in dim(result_array) <- dim(result_array)[pos_new_dims] : 
  dims [product 758160] do not match the length of object [140400]
In addition: Warning messages:
1: ! Warning: CDORemap: Using CDO version 1.6.3. 
2: In pos_new_dims[which(!is.na(pos_test_dims))] <- match(test_dims,  :
  number of items to replace is not a multiple of replacement length
# Error (2)
num_lats <- 25
num_lons <- 50
tas <- array(1:(10*num_lats*10*num_lons), 
             dim = c(10, num_lats, 10, num_lons))
names(dim(tas)) <- c('a', 'j', 'b', 'i')
lon <- array(seq(0, 360 - 360/num_lons, length.out = num_lons), 
             dim = c(num_lons, num_lats))
names(dim(lon)) <- c('i', 'j')
lat <- t(array(seq(-90, 90, length.out = num_lats), 
               dim = c(num_lats, num_lons)))
names(dim(lat)) <- c('i', 'j')
tas2 <- CDORemap(tas, lon, lat, 't17grid', 'bil') # error
 
# Error (3) 
tas2 <- CDORemap(tas, lon, lat, 't17grid', 'bil', FALSE) # error

# Error message (3) on HUB: same as (2) and (1) on HUB

# Error (4)
tas2 <- CDORemap(tas, lon, lat, 'external_file.nc', 'bil') 

Module and Package Version

On HUB:

  • R version 4.2.1 (2022-06-23)
  • s2dv_2.0.0
  • CDO version 2.0.6

On WS:

  • R version 4.1.2 (2021-11-01)
  • CDO version 1.6.3
  • s2dv 2.0.0

Other information

I have not included the error messages (2) and (3) since they were equal for the same environment (HUB and WS). The error message (4) is also not included.

Eva

Edited Jan 10, 2024 by Eva Rifà
Assignee
Assign to
Time tracking