How to implement .N of data.table in H2O, in R? - r

Consider the following code.
library(data.table)
data1x <- "x row1
1 1
1 2
1 3
1 4
2 1
2 2
2 3
3 1
4 2"
data1 <- read.table(textConnection(data1x), header=TRUE)
setDT(data1)
data1[, seqN := 1:.N, by="x"]
I want to do similar thing on h2o data frame. I went through the user manual, but am not able to figure out how to do this using h20.
EDIT : I tried the below code, for h2o, but it is giving error :
library(h2o)
h2o.init()
data1x <- "x row1
1 1
1 2
1 3
1 4
2 1
2 2
2 3
3 1
4 2"
data1x <- read.table(textConnection(data1x), header=TRUE)
data1xH2O <- as.h2o(data1x)
fun = function(df) {
1:nrow(df)
}
h2o.ddply(data1xH2O, "x", fun)
This results in following error :
ERROR: Unexpected HTTP Status code: 400 Bad Request (url = http://localhost:54321/99/Rapids)
water.rapids.Rapids.IllegalASTException
[1] "water.rapids.Rapids$IllegalASTException: Missing a number"
[2] " water.rapids.Rapids.number(Rapids.java:312)"
[3] " water.rapids.Rapids.parseNumList(Rapids.java:243)"
[4] " water.rapids.Rapids.parseList(Rapids.java:208)"
[5] " water.rapids.Rapids.parseNext(Rapids.java:140)"
[6] " water.rapids.Rapids.parseFunctionDefinition(Rapids.java:193)"
[7] " water.rapids.Rapids.parseNext(Rapids.java:139)"
[8] " water.rapids.Rapids.parseFunctionApplication(Rapids.java:158)"
[9] " water.rapids.Rapids.parseNext(Rapids.java:138)"
[10] " water.rapids.Rapids.parseFunctionApplication(Rapids.java:158)"
[11] " water.rapids.Rapids.parseNext(Rapids.java:138)"
[12] " water.rapids.Rapids.parse(Rapids.java:48)"
[13] " water.rapids.Rapids.exec(Rapids.java:81)"
[14] " water.api.RapidsHandler.exec(RapidsHandler.java:39)"
[15] " sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)"
[16] " sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)"
[17] " sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)"
[18] " java.lang.reflect.Method.invoke(Method.java:483)"
[19] " water.api.Handler.handle(Handler.java:61)"
[20] " water.api.RequestServer.serve(RequestServer.java:412)"
[21] " water.api.RequestServer.doGeneric(RequestServer.java:263)"
[22] " water.api.RequestServer.doPost(RequestServer.java:200)"
[23] " javax.servlet.http.HttpServlet.service(HttpServlet.java:755)"
[24] " javax.servlet.http.HttpServlet.service(HttpServlet.java:848)"
[25] " org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:684)"
[26] " org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:503)"
[27] " org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:137)"
[28] " org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:557)"
[29] " org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:231)"
[30] " org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1086)"
[31] " org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:429)"
[32] " org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:193)"
[33] " org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1020)"
[34] " org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:135)"
[35] " org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:154)"
[36] " org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:116)"
[37] " org.eclipse.jetty.server.Server.handle(Server.java:370)"
[38] " org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:494)"
[39] " org.eclipse.jetty.server.BlockingHttpConnection.handleRequest(BlockingHttpConnection.java:53)"
[40] " org.eclipse.jetty.server.AbstractHttpConnection.content(AbstractHttpConnection.java:982)"
[41] " org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.content(AbstractHttpConnection.java:1043)"
[42] " org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:865)"
[43] " org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:240)"
[44] " org.eclipse.jetty.server.BlockingHttpConnection.handle(BlockingHttpConnection.java:72)"
[45] " org.eclipse.jetty.server.bio.SocketConnector$ConnectorEndPoint.run(SocketConnector.java:264)"
[46] " org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:608)"
[47] " org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:543)"
[48] " java.lang.Thread.run(Thread.java:745)"
Error in .h2o.doSafeREST(h2oRestApiVersion = h2oRestApiVersion, urlSuffix = page, :
ERROR MESSAGE:
Missing a number
Any suggestion, what I can do to remove this error.

I did not see this question first however in the following answer fun1 and fun2 are creating the same sequence based on column name you choose.
How to use : function in H2O ddply, R?
is that you are looking for?

Related

How can I split the following string using R?

I want to split the following character string from a chess game into separate strings like the ones below removing the "1-9." pattern while maintaining all the other text.
Example:
text <- "1. e4 e5 2. Nf3 Nf6 3. Nxe5 d6 4. Nd3 Nxe4 5. Qe2 Qe7 6. Nf4 Nf6 7. d4 Nc6 8. c3 d5 9. Nd2 Nd8 10. Nf3 Qxe2+ 11. Bxe2 Bd6 12. O-O O-O 13. Bd3 Re8 14. Re1 Rxe1+ 15. Nxe1 Ne6 16. Nxe6 Bxe6 17. g3 g6 18. Ng2 Re8 19. f3 Nh5 20. Kf2 c6 21. g4 Ng7 22. Bf4 Bxf4 23. Nxf4 g5 24. Ne2 f5 25. h3 Kf7 26. Rh1 h6 27. f4 fxg4 28. hxg4 Bxg4 29. Rxh6 Bf5 30. Bxf5 Nxf5 31. Rh7+ Ng7 32. fxg5 Kg6 33. Rh3 Kxg5 34. Rg3+ Kf6 35. Rf3+ Ke7 36. Nf4 Kd6 37. Ng6 Re6 38. Ne5 Ne8 39. Rf7 Rf6+ 40. Rxf6+ Nxf6 41. Ke3"
Desired result:
text_outcome <- c("e4", "e5", "Nf3", "Nf6", ..., "0-0", "Rg3+",)
So far I've tried:
text_outcome <- strsplit(text, "[^1-9.a-zA-Z]")[[1]] |>
as.data.frame() |>
mutate(text_cleaned = case_when(text_outcome == "O" ~ "O-O",
TRUE ~ text_outcome),
text_cleaned2 = str_replace_all(text_cleaned, "^[1-9].", " ")) |>
filter(!text_cleaned2 == "")
obtaining:
[5] "Nf3" "Nf6" " " "Nxe5"
[9] "d6" " " "Nd3" "Nxe4"
[13] " " "Qe2" "Qe7" " "
[17] "Nf4" "Nf6" " " "d4"
[21] "Nc6" " " "c3" "d5"
[25] " " "Nd2" "Nd8" "1"
[29] "." "Nf3" "Qxe2" " ."
[33] "Bxe2" "Bd6" " ." "O-O"
[37] "O-O" "O-O" "O-O" " ."
[41] "Bd3" "Re8" " ." "Re1"
[45] "Rxe1" " ." "Nxe1" "Ne6"
[49] " ." "Nxe6" "Bxe6" " ."
[53] "g3" "g6" " ." "Ng2"
[57] "Re8" " ." "f3" "Nh5"
[61] "2" "." "Kf2" "c6"
[65] " ." "g4" "Ng7" " ."
[69] "Bf4" "Bxf4" " ." "Nxf4"
[73] "g5" " ." "Ne2" "f5"
[77] " ." "h3" "Kf7" " ."
[81] "Rh1" "h6" " ." "f4"
[85] "fxg4" " ." "hxg4" "Bxg4"
[89] " ." "Rxh6" "Bf5" "3"
[93] "." "Bxf5" "Nxf5" " ."
[97] "Rh7" "Ng7" " ." "fxg5"
[101] "Kg6" " ." "Rh3" "Kxg5"
[105] " ." "Rg3" "Kf6" " ."
[109] "Rf3" "Ke7" " ." "Nf4"
[113] "Kd6" " ." "Ng6" "Re6"
[117] " ." "Ne5" "Ne8" " ."
[121] "Rf7" "Rf6" "4" "."
[125] "Rxf6" "Nxf6" " ." "Ke3"```
I'm sure there's a cleaner way to obtain this while removing the "0-0" duplicates and maintaining the "+" symbols such as Rf3+.
Thanks in advance,
Using str_extract
library(stringr)
str_extract_all(text, "[A-Za-z]\\S+")[[1]]
[1] "e4" "e5" "Nf3" "Nf6" "Nxe5" "d6" "Nd3" "Nxe4" "Qe2" "Qe7" "Nf4" "Nf6" "d4" "Nc6" "c3" "d5" "Nd2" "Nd8" "Nf3" "Qxe2+"
[21] "Bxe2" "Bd6" "O-O" "O-O" "Bd3" "Re8" "Re1" "Rxe1+" "Nxe1" "Ne6" "Nxe6" "Bxe6" "g3" "g6" "Ng2" "Re8" "f3" "Nh5" "Kf2" "c6"
[41] "g4" "Ng7" "Bf4" "Bxf4" "Nxf4" "g5" "Ne2" "f5" "h3" "Kf7" "Rh1" "h6" "f4" "fxg4" "hxg4" "Bxg4" "Rxh6" "Bf5" "Bxf5" "Nxf5"
[61] "Rh7+" "Ng7" "fxg5" "Kg6" "Rh3" "Kxg5" "Rg3+" "Kf6" "Rf3+" "Ke7" "Nf4" "Kd6" "Ng6" "Re6" "Ne5" "Ne8" "Rf7" "Rf6+" "Rxf6+" "Nxf6"
[81] "Ke3"
library(stringr)
x <- str_remove_all(unlist(str_split(text, ' ')), '\\d+\\.')
x[x != ""]
[1] "e4" "e5" "Nf3" "Nf6" "Nxe5" "d6" "Nd3"
[8] "Nxe4" "Qe2" "Qe7" "Nf4" "Nf6" "d4" "Nc6"
[15] "c3" "d5" "Nd2" "Nd8" "Nf3" "Qxe2+" "Bxe2"
[22] "Bd6" "O-O" "O-O" "Bd3" "Re8" "Re1" "Rxe1+"
[29] "Nxe1" "Ne6" "Nxe6" "Bxe6" "g3" "g6" "Ng2"
[36] "Re8" "f3" "Nh5" "Kf2" "c6" "g4" "Ng7"
[43] "Bf4" "Bxf4" "Nxf4" "g5" "Ne2" "f5" "h3"
[50] "Kf7" "Rh1" "h6" "f4" "fxg4" "hxg4" "Bxg4"
[57] "Rxh6" "Bf5" "Bxf5" "Nxf5" "Rh7+" "Ng7" "fxg5"
[64] "Kg6" "Rh3" "Kxg5" "Rg3+" "Kf6" "Rf3+" "Ke7"
[71] "Nf4" "Kd6" "Ng6" "Re6" "Ne5" "Ne8" "Rf7"
[78] "Rf6+" "Rxf6+" "Nxf6" "Ke3"
You can do:
library(stringr)
unlist(str_split(str_remove_all(text, '\\d{1,}\\. '), ' '))
[1] "e4" "e5" "Nf3" "Nf6" "Nxe5" "d6" "Nd3" "Nxe4" "Qe2"
[10] "Qe7" "Nf4" "Nf6" "d4" "Nc6" "c3" "d5" "Nd2" "Nd8"
[19] "Nf3" "Qxe2+" "Bxe2" "Bd6" "O-O" "O-O" "Bd3" "Re8" "Re1"
[28] "Rxe1+" "Nxe1" "Ne6" "Nxe6" "Bxe6" "g3" "g6" "Ng2" "Re8"
[37] "f3" "Nh5" "Kf2" "c6" "g4" "Ng7" "Bf4" "Bxf4" "Nxf4"
[46] "g5" "Ne2" "f5" "h3" "Kf7" "Rh1" "h6" "f4" "fxg4"
[55] "hxg4" "Bxg4" "Rxh6" "Bf5" "Bxf5" "Nxf5" "Rh7+" "Ng7" "fxg5"
[64] "Kg6" "Rh3" "Kxg5" "Rg3+" "Kf6" "Rf3+" "Ke7" "Nf4" "Kd6"
[73] "Ng6" "Re6" "Ne5" "Ne8" "Rf7" "Rf6+" "Rxf6+" "Nxf6" "Ke3"
In base R:
text |> gsub(pattern = '\\d+\\.\\s+', replacement = '') |>
strsplit(' ') |> unlist()
[1] "e4" "e5" "Nf3" "Nf6" "Nxe5" "d6" "Nd3" "Nxe4" "Qe2"
[10] "Qe7" "Nf4" "Nf6" "d4" "Nc6" "c3" "d5" "Nd2" "Nd8"
[19] "Nf3" "Qxe2+" "Bxe2" "Bd6" "O-O" "O-O" "Bd3" "Re8" "Re1"
[28] "Rxe1+" "Nxe1" "Ne6" "Nxe6" "Bxe6" "g3" "g6" "Ng2" "Re8"
[37] "f3" "Nh5" "Kf2" "c6" "g4" "Ng7" "Bf4" "Bxf4" "Nxf4"
[46] "g5" "Ne2" "f5" "h3" "Kf7" "Rh1" "h6" "f4" "fxg4"
[55] "hxg4" "Bxg4" "Rxh6" "Bf5" "Bxf5" "Nxf5" "Rh7+" "Ng7" "fxg5"
[64] "Kg6" "Rh3" "Kxg5" "Rg3+" "Kf6" "Rf3+" "Ke7" "Nf4" "Kd6"
[73] "Ng6" "Re6" "Ne5" "Ne8" "Rf7" "Rf6+" "Rxf6+" "Nxf6" "Ke3"

after spliting how two elements can be put into new two string vector in R

I have split a string vector with
var1=strsplit(USYTDsales, split = "\\(")
var1
and got result like
[[1]]
[1] "160,397 " "-0.9%)"
[[2]]
[1] "52,296 " "+27.6%)"
[[3]]
[1] "399,337 " "+5.2%)"
[[4]]
[1] "58,167 " "-10.8%)"
[[5]]
[1] "1,286,524 " "+5.9%)"
[[6]]
[1] "124,577 " "+3.7%)"
[[7]]
[1] "840,256 " "-1.7%)"
[[8]]
[1] "199,997 " "-13.4%)"
[[9]]
[1] "75,949 " "+5.4%)"
[[10]]
[1] "175,368 " "+2.5%)"
[[11]]
[1] "203,407 " "+8.0%)"
[[12]]
[1] "85,900 " "-2.4%)"
[[13]]
[1] "26,932 " "+1.3%)"
[[14]]
[1] "305,406 " "-5.7%)"
[[15]]
[1] "269,507 " "+2.4%) " "through Q2)"
[[16]]
[1] "378,922 " "-2.6%)"
[[17]]
[1] "188,049 " "+11.5%)"
[[18]]
[1] "574,928 " "+20.9%)"
[[19]]
[1] "109,695 " "-0.6%) " "through Q2)"
[[20]]
[1] "807,570 " "-5.9%)"
[[21]]
[1] "346,675 " "-1.6%)"
[[22]]
[1] "1,019,019 " "+5.2%) " "through Q2)"
[[23]]
[1] "77,277 " "+23.4%)"
[[24]]
[1] "81,917 " "-9.0%)"
[[25]]
[1] "9,525 " "-43.7%)"
[[26]]
[1] "1,411,243 " "-1.5%)"
[[27]]
[1] "282,052 " "-3.5%)"
[[28]]
[1] "100,254 " "-13.1%)"
Now I want to put first part of the split into one vector and second part of the split into another vector.
Assuming the input x shown reproducibly in the Note below, remove the junk characters and read in the strings using read.table:
read.table(text = gsub("[,+%)]", "", x), sep = "(", strip.white = TRUE,
col.names = c("A", "B"))
giving:
A B
1 123456 -0.9
2 987456 1.0
Note
x <- c("123,456 (-0.9%)", "987,456 (1.0%)")

Scientific notation with Rmpfr in R

I am testing some calculation based on the example code from Rmpfr in R.
The test is as follows:
ns <- mpfr(1:24, 120) ; factorial(ns)
However, in my output the result is:
[1] 1e0 2e0 6e0
[4] 2.4e1 1.2e2 7.2e2
[7] 5.04e3 4.032e4 3.6288e5
[10] 3.6288e6 3.99168e7 4.790016e8
[13] 6.2270208e9 8.71782912e10 1.307674368e12
[16] 2.0922789888e13 3.55687428096e14 6.402373705728e15
[19] 1.21645100408832e17 2.43290200817664e18 5.109094217170944e19
[22] 1.12400072777760768e21 2.585201673888497664e22 6.2044840173323943936e23
While in the example output, the scientific notation is got rid of as :
[1] 1 2
[3] 6 24
[5] 120 720
[7] 5040 40320
[9] 362880 3628800
[11] 39916800 479001600
[13] 6227020800 87178291200
[15] 1307674368000 20922789888000
[17] 355687428096000 6402373705728000
[19] 121645100408832000 2432902008176640000
[21] 51090942171709440000 1124000727777607680000
[23] 25852016738884976640000 620448401733239439360000
How could I turn off the scientific notation in this case?
I have tried:
options(scipen=999)
mpfr(1:24, 120,scientific=FALSE)
But none of them are working.
use scipen=0
library(Rmpfr)
options(scipen = 999)
ns <- mpfr(1:24, 120) ; factorial(ns)
# 24 'mpfr' numbers of precision 120 bits
# [1] 1e0 2e0 6e0
# [4] 2.e1 1.e2 7.e2
# [7] 5.0e3 4.03e4 3.628e5
# [10] 3.628e6 3.9916e7 4.79001e8
# [13] 6.227020e9 8.7178291e10 1.30767436e12
# [16] 2.092278988e13 3.5568742809e14 6.40237370572e15
# [19] 1.2164510040883e17 2.4329020081766e18 5.10909421717094e19
# [22] 1.1240007277776076e21 2.58520167388849766e22 6.204484017332394393e23
options(scipen = 0)
ns <- mpfr(1:24, 120) ; factorial(ns)
# 24 'mpfr' numbers of precision 120 bits
# [1] 1 2 6
# [4] 24 120 720
# [7] 5040 40320 362880
# [10] 3628800 39916800 479001600
# [13] 6227020800 87178291200 1307674368000
# [16] 20922789888000 355687428096000 6402373705728000
# [19] 121645100408832000 2432902008176640000 51090942171709440000
# [22] 1124000727777607680000 25852016738884976640000 620448401733239439360000

grepl function does not recognize the euro symbol from scraping directly

I am doing a scrape from the web "fotocasa" in Spain.
I download the item that contains the price doing the following:
url<-"https://www.fotocasa.es/es/comprar/casas/madrid-provincia/todas-las-zonas/l/3?latitude=40.415&longitude=-3.7104&combinedLocationIds=724,14,28,0,0,0,0,0,0"
idealista <- html(url)
price<-idealista %>%
html_nodes("span") %>% #item de precios
html_text()
And I have a vector similar to this:
>price
...
[97] "hace 1 hora" "198.500€"
[99] "198.500€" "€"
[101] "4 habs." "128 m²"
[103] "" ""
[105] "" ""
[107] "" "hace 1 hora"
[109] "6.000.000€" "6.000.000€"
[111] "€" "5 habs."
[113] "641 m²" ""
[115] "" ""
[117] "" ""
[119] "hace 1 hora" "1.800.000€"
[121] "1.800.000€" "€"
[123] "Ha bajado 100.000€" "5 habs."
[125] "800 m²" ""
[127] "" ""
[129] "" ""
[131] "hace 1 hora" "690.000€"
[133] "690.000€" "€"
[135] "Ha bajado 410.000€" "3 habs."
[137] "320 m²" ""
[139] "" ""
...
I want only the values that contains the euro symbol, so what I do is:
>price<-price[grepl("€",price)]
But what I obtain is:
> price
character(0)
Because It did not recognize the euro symbol. If I create a vector which contains the euro symbol and I use the function grepl, It works!, but If I tried directly from the scrapping it does not work.
Question
What should I do to make the "grepl" function recognizes this symbol directly from scraping?
Result:
The result must to be something like this:
> price
[1] "198.500€" "198.500€" "6.000.000€" "6.000.000€" "1.800.000€"
[6] "1.800.000€" "Ha bajado 100.000€" "690.000€" "690.000€" "Ha bajado 410.000€"
[11] "2.450.000€" "2.450.000€" "Ha bajado 450.000€" "1.350.000€" "1.350.000€"
[16] "1.200.000€" "1.200.000€" "2.275.000€" "2.275.000€" "2.200.000€"
[21] "2.200.000€" "540.000€" "540.000€" "975.000€" "975.000€"
[26] "3.750.000€" "3.750.000€" "1.100.000€" "1.100.000€" "1.800.000€"
We can use the unicode
res <- price[grepl("\u20AC",price, perl = TRUE)]
length(res)
#[1] 91
as the OP's code gives
any(grepl("€",price))
#[1] FALSE

Cut out a time margin of netcdf in r

I just generated a large netcdf file from WRF modeling. The file has 143 variables, 122 global attributes and 9 dimension. It covers a 7-day period with a time step of 6 hours. All I wanted to do is to cut out and discard everything for the first day (first 4 time steps) and keep the rest of files. I searched for transNcdfCutFiles function within the ncdf.tools package but was a bit confused at how to properly use it.
I am new to NetCDF processing by R. Any suggestions or help are greatly appreciated!
I could not attached the file as it is pretty large, but here is a list of the variables. Thanks in advance.
names(ncin$var)
[1] "Times" "XLAT"
[3] "XLONG" "LU_INDEX"
[5] "ZNU" "ZNW"
[7] "ZS" "DZS"
[9] "VAR_SSO" "U"
[11] "V" "W"
[13] "PH" "PHB"
[15] "T" "HFX_FORCE"
[17] "LH_FORCE" "TSK_FORCE"
[19] "HFX_FORCE_TEND" "LH_FORCE_TEND"
[21] "TSK_FORCE_TEND" "MU"
[23] "MUB" "NEST_POS"
[25] "P" "PB"
[27] "FNM" "FNP"
[29] "RDNW" "RDN"
[31] "DNW" "DN"
[33] "CFN" "CFN1"
[35] "THIS_IS_AN_IDEAL_RUN" "P_HYD"
[37] "Q2" "T2"
[39] "TH2" "PSFC"
[41] "U10" "V10"
[43] "RDX" "RDY"
[45] "RESM" "ZETATOP"
[47] "CF1" "CF2"
[49] "CF3" "ITIMESTEP"
[51] "XTIME" "QVAPOR"
[53] "QCLOUD" "QRAIN"
[55] "SHDMAX" "SHDMIN"
[57] "SNOALB" "TSLB"
[59] "SMOIS" "SH2O"
[61] "SMCREL" "SEAICE"
[63] "XICEM" "SFROFF"
[65] "UDROFF" "IVGTYP"
[67] "ISLTYP" "VEGFRA"
[69] "GRDFLX" "ACGRDFLX"
[71] "ACSNOM" "SNOW"
[73] "SNOWH" "CANWAT"
[75] "SSTSK" "COSZEN"
[77] "LAI" "VAR"
[79] "MAPFAC_M" "MAPFAC_U"
[81] "MAPFAC_V" "MAPFAC_MX"
[83] "MAPFAC_MY" "MAPFAC_UX"
[85] "MAPFAC_UY" "MAPFAC_VX"
[87] "MF_VX_INV" "MAPFAC_VY"
[89] "F" "E"
[91] "SINALPHA" "COSALPHA"
[93] "HGT" "TSK"
[95] "P_TOP" "T00"
[97] "P00" "TLP"
[99] "TISO" "TLP_STRAT"
[101] "P_STRAT" "MAX_MSTFX"
[103] "MAX_MSTFY" "RAINC"
[105] "RAINSH" "RAINNC"
[107] "SNOWNC" "GRAUPELNC"
[109] "HAILNC" "CLDFRA"
[111] "SWDOWN" "GLW"
[113] "SWNORM" "OLR"
[115] "XLAT_U" "XLONG_U"
[117] "XLAT_V" "XLONG_V"
[119] "ALBEDO" "CLAT"
[121] "ALBBCK" "EMISS"
[123] "NOAHRES" "TMN"
[125] "XLAND" "UST"
[127] "PBLH" "HFX"
[129] "QFX" "LH"
[131] "ACHFX" "ACLHF"
[133] "SNOWC" "SR"
[135] "SAVE_TOPO_FROM_REAL" "HFX_FDDA"
[137] "ISEEDARR_RAND_PERTURB" "ISEEDARR_SPPT"
[139] "ISEEDARR_SKEBS" "LANDMASK"
[141] "LAKEMASK" "SST"
[143] "SST_INPUT"
This is much easier to do from the command line using cdo :
cdo seltimestep,5/nsteps ifile ofile
where nsteps is the number of timesteps in the file.

Resources