Last updated: 2022-04-01
Checks: 7 0
Knit directory: emlr_obs_preprocessing/
This reproducible R Markdown analysis was created with workflowr (version 1.7.0). The Checks tab describes the reproducibility checks that were applied when the results were created. The Past versions tab lists the development history.
Great! Since the R Markdown file has been committed to the Git repository, you know the exact version of the code that produced these results.
Great job! The global environment was empty. Objects defined in the global environment can affect the analysis in your R Markdown file in unknown ways. For reproduciblity it’s best to always run the code in an empty environment.
The command set.seed(20200707)
was run prior to running the code in the R Markdown file. Setting a seed ensures that any results that rely on randomness, e.g. subsampling or permutations, are reproducible.
Great job! Recording the operating system, R version, and package versions is critical for reproducibility.
Nice! There were no cached chunks for this analysis, so you can be confident that you successfully produced the results during this run.
Great job! Using relative paths to the files within your workflowr project makes it easier to run your code on other machines.
Great! You are using Git for version control. Tracking code development and connecting the code version to the results is critical for reproducibility.
The results in this page were generated with repository version a1ea47d. See the Past versions tab to see a history of the changes made to the R Markdown and HTML files.
Note that you need to be careful to ensure that all relevant files for the analysis have been committed to Git prior to generating the results (you can use wflow_publish
or wflow_git_commit
). workflowr only checks the R Markdown file, but you know if there are other scripts or data files that it depends on. Below is the status of the Git repository when the results were generated:
Ignored files:
Ignored: .Rhistory
Ignored: .Rproj.user/
Ignored: data/
Ignored: output/
Untracked files:
Untracked: code/IO_1990_own_crossover_analysis_backup.R
Untracked: code/analysis_regional_clusters.Rmd
Untracked: code/read_GLODAPv2_2020.Rmd
Unstaged changes:
Modified: analysis/_site.yml
Deleted: analysis/analysis_regional_clusters.Rmd
Modified: analysis/read_OceanSODA.Rmd
Modified: code/Workflowr_project_managment.R
Note that any generated files, e.g. HTML, png, CSS, etc., are not included in this status report because it is ok for generated content to have uncommitted changes.
These are the previous versions of the repository in which changes were made to the R Markdown (analysis/read_Gruber_2019.Rmd
) and HTML (docs/read_Gruber_2019.html
) files. If you’ve configured a remote Git repository (see ?wflow_git_remote
), click on the hyperlinks in the table below to view the files as they were in that past version.
File | Version | Author | Date | Message |
---|---|---|---|---|
Rmd | a1ea47d | jens-daniel-mueller | 2022-04-01 | rerun all including arctic and North Atlantic biome |
html | 6e65117 | jens-daniel-mueller | 2022-02-16 | Build site. |
html | f2871b9 | jens-daniel-mueller | 2021-11-20 | Build site. |
html | 0908ee5 | jens-daniel-mueller | 2021-11-15 | Build site. |
html | 61af6e7 | jens-daniel-mueller | 2021-10-12 | Build site. |
Rmd | 730f19a | jens-daniel-mueller | 2021-10-12 | prepare G19 data for RECCAP2 |
html | 2dad8c7 | jens-daniel-mueller | 2021-10-12 | Build site. |
Rmd | 1268707 | jens-daniel-mueller | 2021-10-12 | prepare G19 data for RECCAP2 |
html | 6cef0b0 | jens-daniel-mueller | 2021-09-26 | Build site. |
Rmd | 984ccac | jens-daniel-mueller | 2021-09-26 | read all Gruber 2019 cases |
html | e49875a | jens-daniel-mueller | 2021-07-07 | Build site. |
html | 6312bd4 | jens-daniel-mueller | 2021-07-07 | Build site. |
Rmd | 4905409 | jens-daniel-mueller | 2021-07-07 | rerun with new setup_obs.Rmd file |
html | 58bc706 | jens-daniel-mueller | 2021-07-06 | Build site. |
Rmd | 0db89e1 | jens-daniel-mueller | 2021-07-06 | rerun with revised variable names |
Here, we use the standard case V101 for public and raw data sets.
The publicly available data sets contain only positive Cant estimates.
# open file
dcant <- tidync(paste(
path_gruber_2019,
"dcant_emlr_cstar_gruber_94-07_vs1.nc",
sep = ""
))
# read gamma field as tibble
dcant <- dcant %>% activate(GAMMA_DENS)
dcant_gamma <- dcant %>% hyper_tibble()
# read delta cant field
dcant <- dcant %>% activate(DCANT_01)
dcant <- dcant %>% hyper_tibble()
# join cant and gamma fields
dcant <- left_join(dcant, dcant_gamma)
# harmonize column names and coordinates
dcant <- dcant %>%
rename(lon = LONGITUDE,
lat = LATITUDE,
depth = DEPTH,
gamma = GAMMA_DENS,
dcant_pos = DCANT_01) %>%
mutate(lon = if_else(lon < 20, lon + 360, lon))
rm(dcant_gamma)
dcant_inv <- tidync(paste(
path_gruber_2019,
"inv_dcant_emlr_cstar_gruber_94-07_vs1.nc",
sep = ""
))
dcant_inv <- dcant_inv %>% activate(DCANT_INV01)
dcant_inv <- dcant_inv %>% hyper_tibble()
# harmonize column names and coordinates
dcant_inv <- dcant_inv %>%
rename(lon = LONGITUDE,
lat = LATITUDE,
dcant_pos = DCANT_INV01) %>%
mutate(lon = if_else(lon < 20, lon + 360, lon))
dcant_inv_all <- read_ncdf(
paste(
path_gruber_2019,
"inv_dcant_emlr_cstar_gruber_94-07_vs1.nc",
sep = ""
),
var = sprintf("DCANT_INV%02d", seq(1, 14, 1)),
make_units = FALSE
)
dcant_inv_all <- dcant_inv_all %>% as_tibble()
dcant_inv_all <- dcant_inv_all %>%
pivot_longer(DCANT_INV01:DCANT_INV14,
names_to = "Version_ID",
values_to = "dcant_pos",
names_prefix = "DCANT_INV")
# harmonize column names and coordinates
dcant_inv_all <- dcant_inv_all %>%
rename(lon = LONGITUDE,
lat = LATITUDE) %>%
mutate(lon = if_else(lon < 20, lon + 360, lon))
Internally available data sets also contain negative Cant estimates, as they are generated in the “raw” output of the eMLR mapping step.
# open v 101 file
V101 <- tidync(paste(path_gruber_2019,
"Cant_V101new.nc",
sep = ""))
# create tibble
V101 <- V101 %>% activate(Cant)
V101 <- V101 %>% hyper_tibble()
# harmonize column names and coordinates
V101 <- V101 %>%
rename(lon = longitude,
lat = latitude,
dcant = Cant) %>%
filter(dcant != -999) %>%
mutate(lon = if_else(lon < 20, lon + 360, lon))
# use only three basin to assign general basin mask
# ie this is not specific to the MLR fitting
basinmask <- basinmask %>%
filter(MLR_basins == "4") %>%
select(lat, lon, basin_AIP)
dcant <- inner_join(dcant, basinmask)
dcant_inv_publ <- inner_join(dcant_inv, basinmask)
dcant_inv_all <- inner_join(dcant_inv_all, basinmask)
V101 <- inner_join(V101, basinmask)
# join files
dcant_3d <- inner_join(dcant, V101)
rm(dcant, V101)
dcant_zonal <- m_zonal_mean_sd(dcant_3d)
dcant_inv_layers <- m_dcant_inv(dcant_3d)
dcant_inv <- dcant_inv_layers %>%
filter(inv_depth == params_global$inventory_depth_standard)
p_map_cant_inv(
df = dcant_inv,
var = "dcant",
col = "divergent")
p_map_cant_inv(
df = dcant_inv,
var = "dcant_pos")
p_map_cant_inv(
df = dcant_inv_all %>% mutate(dcant_pos = dcant_pos*(10/13)),
var = "dcant_pos") +
facet_wrap(~ Version_ID, ncol = 2)
p_map_cant_inv(
df = dcant_inv,
var = "dcant_pos")
# join published and calculated data sets
dcant_inv_offset <- inner_join(
dcant_inv %>% rename(dcant_re = dcant_pos),
dcant_inv_publ %>% rename(dcant_pub = dcant_pos)
)
# calculate offset
dcant_inv_offset <- dcant_inv_offset %>%
mutate(dcant_offset = dcant_re - dcant_pub)
# plot map
p_map_cant_inv(
df = dcant_inv_offset,
var = "dcant_offset",
col = "divergent",
breaks = seq(-3, 3, 0.25)
)
rm(dcant_inv_offset, dcant_inv_publ)
p_map_climatology(
df = dcant_3d,
var = "dcant",
col = "divergent")
p_map_climatology(
df = dcant_3d,
var = "dcant_pos")
dcant_zonal %>%
group_split(basin_AIP) %>%
head(1) %>%
map(
~ p_section_zonal(
df = .x,
var = "dcant_pos_mean",
plot_slabs = "n",
subtitle_text = paste("Basin:", unique(.x$basin_AIP))
)
)
[[1]]
p_section_global(
df = dcant_3d,
var = "dcant",
col = "divergent")
Version | Author | Date |
---|---|---|
58bc706 | jens-daniel-mueller | 2021-07-06 |
p_section_global(
df = dcant_3d,
var = "dcant_pos")
Version | Author | Date |
---|---|---|
58bc706 | jens-daniel-mueller | 2021-07-06 |
p_section_climatology_regular(
df = dcant_3d,
var = "dcant",
col = "divergent")
Version | Author | Date |
---|---|---|
58bc706 | jens-daniel-mueller | 2021-07-06 |
p_section_climatology_regular(
df = dcant_3d,
var = "dcant_pos")
Version | Author | Date |
---|---|---|
58bc706 | jens-daniel-mueller | 2021-07-06 |
p_section_climatology_regular(
df = dcant_3d,
var = "gamma")
Version | Author | Date |
---|---|---|
58bc706 | jens-daniel-mueller | 2021-07-06 |
dcant_3d %>%
write_csv(paste(path_preprocessing,
"G19_dcant_3d.csv",
sep = ""))
dcant_inv %>%
write_csv(paste(path_preprocessing,
"G19_dcant_inv.csv",
sep = ""))
dcant_inv_all %>%
write_csv(paste(path_preprocessing,
"G19_dcant_inv_all.csv",
sep = ""))
dcant_zonal %>%
write_csv(paste(path_preprocessing,
"G19_dcant_zonal.csv",
sep = ""))
# extract coordinate reference system
G19_raster <- raster::brick(paste0(
path_gruber_2019,
"dcant_emlr_cstar_gruber_94-07_vs1.nc"))
coord_ref <- raster::crs(G19_raster)
rm(G19_raster)
# open nc file for data extraction
dcant_nc <- tidync(paste(
path_gruber_2019,
"dcant_emlr_cstar_gruber_94-07_vs1.nc",
sep = ""
))
# read delta cant field
dcant <- dcant_nc %>%
activate(DCANT_01) %>%
hyper_tibble(na.rm = FALSE)
# read delta cant field
gamma <- dcant_nc %>%
activate(GAMMA_DENS) %>%
hyper_tibble(na.rm = FALSE)
# join gamma and dcant
dcant <- full_join(dcant, gamma)
rm(gamma)
# harmonize column names and coordinates
dcant <- dcant %>%
rename(lon = LONGITUDE,
lat = LATITUDE,
depth = DEPTH,
dcant = DCANT_01,
gamma = GAMMA_DENS) %>%
mutate(gamma = if_else(is.na(dcant), NaN, gamma))
# convert dcant unit from "µmol kg-1" to "mol m-3"
dcant <- dcant %>%
mutate(dens = (1000 + gamma) / 1000,
dcant = dcant * dens * 1e-3)
# create volume grid
dcant <- dcant %>%
m_layer_thickness() %>%
mutate(surface_area = marelac::earth_surf(lat, lon),
volume = layer_thickness * surface_area,
volume = if_else(is.na(dcant), NaN, volume))
# check total volume
dcant %>%
summarise(total_ocean_volume = sum(volume, na.rm = TRUE))
# A tibble: 1 × 1
total_ocean_volume
<dbl>
1 1.25e18
# check total dcant
dcant %>%
filter(depth <= 3000) %>%
mutate(dcant_inv = dcant * volume) %>%
summarise(total_dcant = sum(dcant_inv, na.rm = TRUE)*12*1e-15)
# A tibble: 1 × 1
total_dcant
<dbl>
1 31.8
# select relevant columns
dcant <- dcant %>%
select(lon, lat, depth, dcant, volume)
# create raster objects
volume_raster <- dcant %>%
select(lon, lat, volume) %>%
base::split(dcant$depth) %>%
lapply(raster::rasterFromXYZ) %>%
raster::brick() %>%
raster::setZ(z = unique(dcant$depth), name = "volume")
dcant_raster <- dcant %>%
select(lon, lat, dcant) %>%
base::split(dcant$depth) %>%
lapply(raster::rasterFromXYZ) %>%
raster::brick() %>%
raster::setZ(z = unique(dcant$depth), name = "dcant")
# assign coordinate reference system
raster::crs(dcant_raster) <- coord_ref
raster::crs(volume_raster) <- coord_ref
# assign NA values
raster::NAvalue(dcant_raster) <- -9999
raster::NAvalue(dcant_raster)
[1] -9999
raster::NAvalue(volume_raster) <- -9999
raster::NAvalue(volume_raster)
[1] -9999
# check object
dim(dcant_raster)
[1] 180 360 33
raster::nbands(dcant_raster)
[1] 1
raster::nlayers(dcant_raster)
[1] 33
names(dcant_raster) #get the names of layers
[1] "X0" "X10" "X20" "X30" "X50" "X75" "X100" "X125" "X150"
[10] "X200" "X250" "X300" "X400" "X500" "X600" "X700" "X800" "X900"
[19] "X1000" "X1100" "X1200" "X1300" "X1400" "X1500" "X1750" "X2000" "X2500"
[28] "X3000" "X3500" "X4000" "X4500" "X5000" "X5500"
raster::getZ(dcant_raster)
[1] 0 10 20 30 50 75 100 125 150 200 250 300 400 500 600
[16] 700 800 900 1000 1100 1200 1300 1400 1500 1750 2000 2500 3000 3500 4000
[31] 4500 5000 5500
# write netcdf file
raster::writeRaster(
dcant_raster,
filename = paste0(path_preprocessing,
"dcant_Gruber2019_1994-2007_v20211012.nc"),
overwrite = T
)
raster::writeRaster(
volume_raster,
filename = paste0(path_preprocessing,
"volume_Gruber2019_1994-2007_v20211012.nc"),
overwrite = T
)
# modify created netcdf files
library(ncdf4)
# dcant file
# open file in writing mode
dcant_reopen <- nc_open(
paste0(path_preprocessing,
"dcant_Gruber2019_1994-2007_v20211012.nc"),
write = TRUE)
dcant_reopen
File /nfs/kryo/work/jenmueller/emlr_cant/observations/preprocessing/dcant_Gruber2019_1994-2007_v20211012.nc (NC_FORMAT_CLASSIC):
2 variables (excluding dimension variables):
int crs[]
proj4: +proj=longlat +datum=WGS84 +no_defs
float dcant[longitude,latitude,z]
_FillValue: -3.39999995214436e+38
grid_mapping: crs
proj4: +proj=longlat +datum=WGS84 +no_defs
min: 0
min: 0
min: 0
min: 0
min: 0
min: 0
min: 0
min: 0
min: 0
min: 0
min: 0
min: 0
min: 0
min: 0
min: 0
min: 0
min: 0
min: 0
min: 0
min: 0
min: 0
min: 0
min: 0
min: 0
min: 0
min: 0
min: 0
min: 0
min: 0
min: 0
min: 0
min: 0
min: 0
max: 0.0248421741701018
max: 0.0263988532810143
max: 0.0259323226992999
max: 0.0468319294577161
max: 0.0539228878337458
max: 0.0579115449847562
max: 0.0591300899669754
max: 0.0595068498539064
max: 0.0591967236903614
max: 0.0622757641709907
max: 0.0701156483511376
max: 0.0822125437177265
max: 0.0895806756023294
max: 0.0465109463416744
max: 0.0447200492198721
max: 0.022305883055381
max: 0.0186725092366003
max: 0.0160326506043697
max: 0.0148016268892587
max: 0.011432505514404
max: 0.0127706811725398
max: 0.0131554593368835
max: 0.0110274898367661
max: 0.0123063573857286
max: 0.0129442649462616
max: 0.00788267650599191
max: 0.00889479200777699
max: 0.00910296888252653
max: 0.016749840595237
max: 0.0143819581236115
max: 0.0205526824791368
max: 0.0269090482439296
max: 0.0229962165359498
3 dimensions:
longitude Size:360
units: degrees_east
long_name: longitude
latitude Size:180
units: degrees_north
long_name: latitude
z Size:33 *** is unlimited ***
units: unknown
long_name: z
3 global attributes:
Conventions: CF-1.4
created_by: R, packages ncdf4 and raster (version 3.5-11)
date: 2022-04-01 14:05:58
print(dcant_reopen)
File /nfs/kryo/work/jenmueller/emlr_cant/observations/preprocessing/dcant_Gruber2019_1994-2007_v20211012.nc (NC_FORMAT_CLASSIC):
2 variables (excluding dimension variables):
int crs[]
proj4: +proj=longlat +datum=WGS84 +no_defs
float dcant[longitude,latitude,z]
_FillValue: -3.39999995214436e+38
grid_mapping: crs
proj4: +proj=longlat +datum=WGS84 +no_defs
min: 0
min: 0
min: 0
min: 0
min: 0
min: 0
min: 0
min: 0
min: 0
min: 0
min: 0
min: 0
min: 0
min: 0
min: 0
min: 0
min: 0
min: 0
min: 0
min: 0
min: 0
min: 0
min: 0
min: 0
min: 0
min: 0
min: 0
min: 0
min: 0
min: 0
min: 0
min: 0
min: 0
max: 0.0248421741701018
max: 0.0263988532810143
max: 0.0259323226992999
max: 0.0468319294577161
max: 0.0539228878337458
max: 0.0579115449847562
max: 0.0591300899669754
max: 0.0595068498539064
max: 0.0591967236903614
max: 0.0622757641709907
max: 0.0701156483511376
max: 0.0822125437177265
max: 0.0895806756023294
max: 0.0465109463416744
max: 0.0447200492198721
max: 0.022305883055381
max: 0.0186725092366003
max: 0.0160326506043697
max: 0.0148016268892587
max: 0.011432505514404
max: 0.0127706811725398
max: 0.0131554593368835
max: 0.0110274898367661
max: 0.0123063573857286
max: 0.0129442649462616
max: 0.00788267650599191
max: 0.00889479200777699
max: 0.00910296888252653
max: 0.016749840595237
max: 0.0143819581236115
max: 0.0205526824791368
max: 0.0269090482439296
max: 0.0229962165359498
3 dimensions:
longitude Size:360
units: degrees_east
long_name: longitude
latitude Size:180
units: degrees_north
long_name: latitude
z Size:33 *** is unlimited ***
units: unknown
long_name: z
3 global attributes:
Conventions: CF-1.4
created_by: R, packages ncdf4 and raster (version 3.5-11)
date: 2022-04-01 14:05:58
names(dcant_reopen$var)
[1] "crs" "dcant"
# add units
ncatt_get(dcant_reopen, varid = "dcant")
$`_FillValue`
[1] -3.4e+38
$grid_mapping
[1] "crs"
$proj4
[1] "+proj=longlat +datum=WGS84 +no_defs"
$min
[1] 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
$max
[1] 0.024842174 0.026398853 0.025932323 0.046831929 0.053922888 0.057911545
[7] 0.059130090 0.059506850 0.059196724 0.062275764 0.070115648 0.082212544
[13] 0.089580676 0.046510946 0.044720049 0.022305883 0.018672509 0.016032651
[19] 0.014801627 0.011432506 0.012770681 0.013155459 0.011027490 0.012306357
[25] 0.012944265 0.007882677 0.008894792 0.009102969 0.016749841 0.014381958
[31] 0.020552682 0.026909048 0.022996217
ncatt_put(dcant_reopen, varid = "dcant",
attname = "units", attval = "mol m-3")
ncatt_get(dcant_reopen, varid = "z")
$units
[1] "unknown"
$long_name
[1] "z"
ncatt_put(dcant_reopen, varid = "z",
attname = "units", attval = "metres")
nc_close(dcant_reopen)
# volume file
# open file in writing mode
volume_reopen <- nc_open(
paste0(path_preprocessing,
"volume_Gruber2019_1994-2007_v20211012.nc"),
write = TRUE)
volume_reopen
File /nfs/kryo/work/jenmueller/emlr_cant/observations/preprocessing/volume_Gruber2019_1994-2007_v20211012.nc (NC_FORMAT_CLASSIC):
2 variables (excluding dimension variables):
int crs[]
proj4: +proj=longlat +datum=WGS84 +no_defs
float volume[longitude,latitude,z]
_FillValue: -3.39999995214436e+38
grid_mapping: crs
proj4: +proj=longlat +datum=WGS84 +no_defs
min: 13557913860.915
min: 27115827721.8299
min: 27115827721.8299
min: 40673741582.7449
min: 61010612374.1174
min: 67789569304.5748
min: 67789569304.5748
min: 67789569304.5748
min: 101684353956.862
min: 135579138609.15
min: 135579138609.15
min: 203368707913.725
min: 271158277218.299
min: 271158277218.299
min: 271158277218.299
min: 314515048709.952
min: 314515048709.952
min: 314515048709.952
min: 314515048709.952
min: 314515048709.952
min: 314515048709.952
min: 314515048709.952
min: 314515048709.952
min: 550401335242.417
min: 786287621774.881
min: 1179431432662.32
min: 1572575243549.76
min: 1777833760784.07
min: 1878515185661.79
min: 1979171773639.54
min: 2079803524717.3
min: 2482082160028.49
min: 1631799437103.27
max: 62002375113.084
max: 124004750226.168
max: 124004750226.168
max: 186007125339.252
max: 279010688008.878
max: 310011875565.42
max: 310011875565.42
max: 310011875565.42
max: 465017813348.13
max: 620023751130.84
max: 620023751130.84
max: 930035626696.26
max: 1240047502261.68
max: 1240047502261.68
max: 1240047502261.68
max: 1240047502261.68
max: 1240047502261.68
max: 1240047502261.68
max: 1240047502261.68
max: 1240047502261.68
max: 1240047502261.68
max: 1240047502261.68
max: 1240047502261.68
max: 2170083128957.94
max: 3100118755654.2
max: 4650178133481.3
max: 6200237511308.4
max: 6200237511308.4
max: 6200237511308.4
max: 6200237511308.4
max: 6200237511308.4
max: 6200237511308.4
max: 3100118755654.2
3 dimensions:
longitude Size:360
units: degrees_east
long_name: longitude
latitude Size:180
units: degrees_north
long_name: latitude
z Size:33 *** is unlimited ***
units: unknown
long_name: z
3 global attributes:
Conventions: CF-1.4
created_by: R, packages ncdf4 and raster (version 3.5-11)
date: 2022-04-01 14:05:58
print(volume_reopen)
File /nfs/kryo/work/jenmueller/emlr_cant/observations/preprocessing/volume_Gruber2019_1994-2007_v20211012.nc (NC_FORMAT_CLASSIC):
2 variables (excluding dimension variables):
int crs[]
proj4: +proj=longlat +datum=WGS84 +no_defs
float volume[longitude,latitude,z]
_FillValue: -3.39999995214436e+38
grid_mapping: crs
proj4: +proj=longlat +datum=WGS84 +no_defs
min: 13557913860.915
min: 27115827721.8299
min: 27115827721.8299
min: 40673741582.7449
min: 61010612374.1174
min: 67789569304.5748
min: 67789569304.5748
min: 67789569304.5748
min: 101684353956.862
min: 135579138609.15
min: 135579138609.15
min: 203368707913.725
min: 271158277218.299
min: 271158277218.299
min: 271158277218.299
min: 314515048709.952
min: 314515048709.952
min: 314515048709.952
min: 314515048709.952
min: 314515048709.952
min: 314515048709.952
min: 314515048709.952
min: 314515048709.952
min: 550401335242.417
min: 786287621774.881
min: 1179431432662.32
min: 1572575243549.76
min: 1777833760784.07
min: 1878515185661.79
min: 1979171773639.54
min: 2079803524717.3
min: 2482082160028.49
min: 1631799437103.27
max: 62002375113.084
max: 124004750226.168
max: 124004750226.168
max: 186007125339.252
max: 279010688008.878
max: 310011875565.42
max: 310011875565.42
max: 310011875565.42
max: 465017813348.13
max: 620023751130.84
max: 620023751130.84
max: 930035626696.26
max: 1240047502261.68
max: 1240047502261.68
max: 1240047502261.68
max: 1240047502261.68
max: 1240047502261.68
max: 1240047502261.68
max: 1240047502261.68
max: 1240047502261.68
max: 1240047502261.68
max: 1240047502261.68
max: 1240047502261.68
max: 2170083128957.94
max: 3100118755654.2
max: 4650178133481.3
max: 6200237511308.4
max: 6200237511308.4
max: 6200237511308.4
max: 6200237511308.4
max: 6200237511308.4
max: 6200237511308.4
max: 3100118755654.2
3 dimensions:
longitude Size:360
units: degrees_east
long_name: longitude
latitude Size:180
units: degrees_north
long_name: latitude
z Size:33 *** is unlimited ***
units: unknown
long_name: z
3 global attributes:
Conventions: CF-1.4
created_by: R, packages ncdf4 and raster (version 3.5-11)
date: 2022-04-01 14:05:58
names(volume_reopen$var)
[1] "crs" "volume"
# add units
ncatt_get(volume_reopen, varid = "volume")
$`_FillValue`
[1] -3.4e+38
$grid_mapping
[1] "crs"
$proj4
[1] "+proj=longlat +datum=WGS84 +no_defs"
$min
[1] 1.355791e+10 2.711583e+10 2.711583e+10 4.067374e+10 6.101061e+10
[6] 6.778957e+10 6.778957e+10 6.778957e+10 1.016844e+11 1.355791e+11
[11] 1.355791e+11 2.033687e+11 2.711583e+11 2.711583e+11 2.711583e+11
[16] 3.145150e+11 3.145150e+11 3.145150e+11 3.145150e+11 3.145150e+11
[21] 3.145150e+11 3.145150e+11 3.145150e+11 5.504013e+11 7.862876e+11
[26] 1.179431e+12 1.572575e+12 1.777834e+12 1.878515e+12 1.979172e+12
[31] 2.079804e+12 2.482082e+12 1.631799e+12
$max
[1] 6.200238e+10 1.240048e+11 1.240048e+11 1.860071e+11 2.790107e+11
[6] 3.100119e+11 3.100119e+11 3.100119e+11 4.650178e+11 6.200238e+11
[11] 6.200238e+11 9.300356e+11 1.240048e+12 1.240048e+12 1.240048e+12
[16] 1.240048e+12 1.240048e+12 1.240048e+12 1.240048e+12 1.240048e+12
[21] 1.240048e+12 1.240048e+12 1.240048e+12 2.170083e+12 3.100119e+12
[26] 4.650178e+12 6.200238e+12 6.200238e+12 6.200238e+12 6.200238e+12
[31] 6.200238e+12 6.200238e+12 3.100119e+12
ncatt_put(volume_reopen, varid = "volume",
attname = "units", attval = "m3")
ncatt_get(volume_reopen, varid = "z")
$units
[1] "unknown"
$long_name
[1] "z"
ncatt_put(volume_reopen, varid = "z",
attname = "units", attval = "metres")
nc_close(volume_reopen)
# final check dcant
dcant_reopen <- tidync(
paste0(path_preprocessing,
"dcant_Gruber2019_1994-2007_v20211012.nc")) %>%
hyper_tibble()
dcant_reopen %>%
filter(z == 0) %>%
ggplot(aes(longitude, latitude, fill=dcant)) +
geom_raster() +
scale_fill_viridis_c()
Version | Author | Date |
---|---|---|
2dad8c7 | jens-daniel-mueller | 2021-10-12 |
dcant_reopen %>%
filter(longitude == 200.5) %>%
ggplot(aes(latitude, z, z=dcant)) +
scale_y_reverse() +
geom_contour_filled() +
scale_fill_viridis_d()
Version | Author | Date |
---|---|---|
2dad8c7 | jens-daniel-mueller | 2021-10-12 |
dcant_reopen <- read_ncdf(
paste0(path_preprocessing,
"dcant_Gruber2019_1994-2007_v20211012.nc"))
Error in UseMethod("GPFN") :
no applicable method for 'GPFN' applied to an object of class "list"
plot(dcant_reopen,
axes = TRUE)
Version | Author | Date |
---|---|---|
2dad8c7 | jens-daniel-mueller | 2021-10-12 |
# final check volume
volume_reopen <- tidync(
paste0(path_preprocessing,
"volume_Gruber2019_1994-2007_v20211012.nc")) %>%
hyper_tibble()
volume_reopen %>%
filter(z == 0) %>%
ggplot(aes(longitude, latitude, fill=volume)) +
geom_raster() +
scale_fill_viridis_c()
Version | Author | Date |
---|---|---|
2dad8c7 | jens-daniel-mueller | 2021-10-12 |
volume_reopen %>%
filter(longitude == 200.5) %>%
ggplot(aes(latitude, z, z=volume)) +
scale_y_reverse() +
geom_contour_filled() +
scale_fill_viridis_d()
Version | Author | Date |
---|---|---|
2dad8c7 | jens-daniel-mueller | 2021-10-12 |
volume_reopen <- read_ncdf(
paste0(path_preprocessing,
"volume_Gruber2019_1994-2007_v20211012.nc"))
Error in UseMethod("GPFN") :
no applicable method for 'GPFN' applied to an object of class "list"
plot(volume_reopen,
axes = TRUE)
Version | Author | Date |
---|---|---|
2dad8c7 | jens-daniel-mueller | 2021-10-12 |
sessionInfo()
R version 4.1.2 (2021-11-01)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: openSUSE Leap 15.3
Matrix products: default
BLAS: /usr/local/R-4.1.2/lib64/R/lib/libRblas.so
LAPACK: /usr/local/R-4.1.2/lib64/R/lib/libRlapack.so
locale:
[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C
[3] LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8
[5] LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8
[7] LC_PAPER=en_US.UTF-8 LC_NAME=C
[9] LC_ADDRESS=C LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] ncdf4_1.19 stars_0.5-5 sf_1.0-5 abind_1.4-5
[5] tidync_0.2.4 colorspace_2.0-2 marelac_2.1.10 shape_1.4.6
[9] ggforce_0.3.3 metR_0.11.0 scico_1.3.0 patchwork_1.1.1
[13] collapse_1.7.0 forcats_0.5.1 stringr_1.4.0 dplyr_1.0.7
[17] purrr_0.3.4 readr_2.1.1 tidyr_1.1.4 tibble_3.1.6
[21] ggplot2_3.3.5 tidyverse_1.3.1 workflowr_1.7.0
loaded via a namespace (and not attached):
[1] ellipsis_0.3.2 class_7.3-20 rgdal_1.5-28 rprojroot_2.0.2
[5] fs_1.5.2 rstudioapi_0.13 proxy_0.4-26 farver_2.1.0
[9] bit64_4.0.5 fansi_1.0.2 lubridate_1.8.0 xml2_1.3.3
[13] codetools_0.2-18 knitr_1.37 polyclip_1.10-0 jsonlite_1.7.3
[17] gsw_1.0-6 broom_0.7.11 dbplyr_2.1.1 compiler_4.1.2
[21] httr_1.4.2 backports_1.4.1 assertthat_0.2.1 fastmap_1.1.0
[25] cli_3.1.1 later_1.3.0 tweenr_1.0.2 htmltools_0.5.2
[29] tools_4.1.2 gtable_0.3.0 glue_1.6.0 Rcpp_1.0.8
[33] cellranger_1.1.0 jquerylib_0.1.4 RNetCDF_2.5-2 raster_3.5-11
[37] vctrs_0.3.8 lwgeom_0.2-8 xfun_0.29 ps_1.6.0
[41] rvest_1.0.2 lifecycle_1.0.1 ncmeta_0.3.0 terra_1.5-12
[45] oce_1.5-0 getPass_0.2-2 MASS_7.3-55 scales_1.1.1
[49] vroom_1.5.7 hms_1.1.1 promises_1.2.0.1 parallel_4.1.2
[53] yaml_2.2.1 sass_0.4.0 stringi_1.7.6 highr_0.9
[57] e1071_1.7-9 checkmate_2.0.0 rlang_0.4.12 pkgconfig_2.0.3
[61] lattice_0.20-45 evaluate_0.14 SolveSAPHE_2.1.0 labeling_0.4.2
[65] bit_4.0.4 processx_3.5.2 tidyselect_1.1.1 seacarb_3.3.0
[69] magrittr_2.0.1 R6_2.5.1 generics_0.1.1 DBI_1.1.2
[73] pillar_1.6.4 haven_2.4.3 whisker_0.4 withr_2.4.3
[77] units_0.7-2 sp_1.4-6 modelr_0.1.8 crayon_1.4.2
[81] KernSmooth_2.23-20 utf8_1.2.2 tzdb_0.2.0 rmarkdown_2.11
[85] grid_4.1.2 readxl_1.3.1 isoband_0.2.5 data.table_1.14.2
[89] callr_3.7.0 git2r_0.29.0 reprex_2.0.1 digest_0.6.29
[93] classInt_0.4-3 httpuv_1.6.5 munsell_0.5.0 viridisLite_0.4.0
[97] bslib_0.3.1