-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathjunk.rb
53 lines (25 loc) · 1.19 KB
/
junk.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
require "rubygems"
require "numru/netcdf"
@global_biome_marsh = NumRu::NetCDF.open("netcdf/GCS/biomes/MarshAndSwampland.nc")
@global_biome_marsh_num = @global_biome_marsh.var("Mrsh_Swmp")[390,83,0,0][0]
p @global_biome_marsh.var_names[-1]#.to_s#.split("=")[-1].to_s
#@global_biome_marsh.var("Mrsh_Swmp").get.length
#@global_biome_marsh.var("Mrsh_Swmp").dim(0)
#puts @global_biome_marsh.var("Mrsh_Swmp").get[0..5,10]#[0]
#puts @global_biome_marsh.var("Mrsh_Swmp")
#puts @global_biome_marsh.var("Mrsh_Swmp").get.min
#puts @global_biome_marsh.var("Mrsh_Swmp").get.max
# http://www.andrewsturges.com/2011/04/using-rubynetcdf-to-read-netcdf-files.html
@dims, @dims['lat'], @dims['lng'] = {}, @global_biome_marsh.var("lat"), @global_biome_marsh.var("lng")
puts " ## Lon"
puts @dims['lng'].get.shape # max i value
puts @dims['lng'].get.min
puts @dims['lng'].get.max
puts " ## Lat"
puts @global_biome_marsh.var("lat").get.shape # max j value
puts @global_biome_marsh.var("lat").get.min
puts @global_biome_marsh.var("lat").get.max
#var_temp = file1.var("T") # open variable
#temp = var_temp.get # get values of variable
#p temp # show the values
#p temp[0..4,10,true] # show the part of values