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
  • Merge requests
  • !64

Replace ArrayToNetCDF in CDORemap with easyNCDF::ArrayToNc

  • Review changes

  • Download
  • Patches
  • Plain diff
Merged aho requested to merge develop-CDORemap_ArrayToNc into master May 19, 2021
  • Overview 3
  • Commits 3
  • Pipelines 2
  • Changes 4

Hi @nperez

s2dverification has a function ArrayToNetCDF() for CDORemap(), but it is highly similar to easyNCDF::ArrayToNc, so I substituted ArrayToNetCDF() with easyNCDF::ArrayToNc. I checked the two functions, easyNCDF::ArrayToNc has a few improvement compared to ArrayToNetCDF(). I ran the following script and the result seems fine (though not exactly the same.)

The downside is that s2dv has one more dependency on easyNCDF. Please let me know your opinion, thanks!

library(startR)
data <- Start(dat = "/esarchive/exp/ecmwf/system5_m1/monthly_mean/tas_f6h/$var$_$sdate$.nc",
              var = 'tas', 
              sdate = '20170101',
              ensemble = indices(1),
              time = indices(1), 
              latitude ='all',
              longitude = 'all',
              return_vars = list(time = 'sdate', longitude = NULL, latitude = NULL),
              retrieve = T)
lon <- as.vector(attr(data, 'Variables')$common$longitude)
lat <- as.vector(attr(data, 'Variables')$common$latitude)

source('~/s2dv/R/CDORemap.R')  # use easyNCDF::ArraytoNc
res_new <- CDORemap(data, lon, lat, 'bil', TRUE)
res_old <- s2dverification::CDORemap(data, lon, lat, 'bil', TRUE)  # 'con' has the same result
all.equal(res_new,res_old)
[1] "Component “data_array”: Mean relative difference: 2.582252e-08"

Cheers,
An-Chi

Assignee
Assign to
Reviewers
Request review from
Time tracking
Source branch: develop-CDORemap_ArrayToNc