Skip to content
GitLab
Projects Groups Topics Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Sign in
  • CSTools CSTools
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributor statistics
    • Graph
    • Compare revisions
  • Issues 28
    • Issues 28
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 2
    • Merge requests 2
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Monitor
    • Monitor
    • Metrics
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • External
  • CSToolsCSTools
  • Issues
  • #160
Closed
Open
Issue created Apr 09, 2025 by Nuria Pérez-Zanón@nperezMaintainer

CST_Subset and s2dv_Cube definition doubts

Hi @tkariyat,

Using CST_Subset I got the error Error in x$attrs$Variable$metadata[[variable]] : subscript out of bounds

I have tested Subset(), and it worked. I need to reorder the hindcast according to the observations on the latitudinal dimension. My code looks like this:

    indices <- match(hcst$coord$latitude, obs$coord$latitude)
    hcst <- CST_Subset(hcst, along = 'latitude', indices = indices)

These are the indices

Browse[1]> indices
  [1] 180 179 178 177 176 175 174 173 172 171 170 169 168 167 166 165 164 163
 [19] 162 161 160 159 158 157 156 155 154 153 152 151 150 149 148 147 146 145
 [37] 144 143 142 141 140 139 138 137 136 135 134 133 132 131 130 129 128 127
 [55] 126 125 124 123 122 121 120 119 118 117 116 115 114 113 112 111 110 109
 [73] 108 107 106 105 104 103 102 101 100  99  98  97  96  95  94  93  92  91
 [91]  90  89  88  87  86  85  84  83  82  81  80  79  78  77  76  75  74  73
[109]  72  71  70  69  68  67  66  65  64  63  62  61  60  59  58  57  56  55
[127]  54  53  52  51  50  49  48  47  46  45  44  43  42  41  40  39  38  37
[145]  36  35  34  33  32  31  30  29  28  27  26  25  24  23  22  21  20  19
[163]  18  17  16  15  14  13  12  11  10   9   8   7   6   5   4   3   2   1

My object hcst is a s2dv_cube that has latitude defined in the coords:

hcst$coord$latitude
  [1]  89.5  88.5  87.5  86.5  85.5  84.5  83.5  82.5  81.5  80.5  79.5  78.5
 [13]  77.5  76.5  75.5  74.5  73.5  72.5  71.5  70.5  69.5  68.5  67.5  66.5
 [25]  65.5  64.5  63.5  62.5  61.5  60.5  59.5  58.5  57.5  56.5  55.5  54.5
 [37]  53.5  52.5  51.5  50.5  49.5  48.5  47.5  46.5  45.5  44.5  43.5  42.5
 [49]  41.5  40.5  39.5  38.5  37.5  36.5  35.5  34.5  33.5  32.5  31.5  30.5
 [61]  29.5  28.5  27.5  26.5  25.5  24.5  23.5  22.5  21.5  20.5  19.5  18.5
 [73]  17.5  16.5  15.5  14.5  13.5  12.5  11.5  10.5   9.5   8.5   7.5   6.5
 [85]   5.5   4.5   3.5   2.5   1.5   0.5  -0.5  -1.5  -2.5  -3.5  -4.5  -5.5
 [97]  -6.5  -7.5  -8.5  -9.5 -10.5 -11.5 -12.5 -13.5 -14.5 -15.5 -16.5 -17.5
[109] -18.5 -19.5 -20.5 -21.5 -22.5 -23.5 -24.5 -25.5 -26.5 -27.5 -28.5 -29.5
[121] -30.5 -31.5 -32.5 -33.5 -34.5 -35.5 -36.5 -37.5 -38.5 -39.5 -40.5 -41.5
[133] -42.5 -43.5 -44.5 -45.5 -46.5 -47.5 -48.5 -49.5 -50.5 -51.5 -52.5 -53.5
[145] -54.5 -55.5 -56.5 -57.5 -58.5 -59.5 -60.5 -61.5 -62.5 -63.5 -64.5 -65.5
[157] -66.5 -67.5 -68.5 -69.5 -70.5 -71.5 -72.5 -73.5 -74.5 -75.5 -76.5 -77.5
[169] -78.5 -79.5 -80.5 -81.5 -82.5 -83.5 -84.5 -85.5 -86.5 -87.5 -88.5 -89.5

but not in the metadata

hcst$attrs$Variable$metadata
$tas
$tas$long_name
[1] "2m Temperature (AV)"

$tas$units
[1] "K"

Does this metadata need to be repeated in both places of the s2dv_cube? Could the function include a check if the latitude do not appear in the metadata to avoid the transformation?

Well, I will look for a workaround, but I wanted to inform you just in case.

Cheers,

Núria

FYI @vagudets

Assignee
Assign to
Time tracking