I am trying to extract all the levels from a particular NetCDF file in R. I can do this manually by extracting each level as one line of code then combining them as a data frame. But this is very long when I have many files. Is it possible to extract all 43 layers in one file?
I have used this How to extract all levels from a netcdf file using the raster package? and Plotting netcdf file with levels in R as a guidance
In essence the nitrate data from
https://www.nodc.noaa.gov/cgi-bin/OC5/woa18/woa18oxnu.pl has the concentration at 43 different depths. Is it possible to extract all the depths for a particular location?
I can do this for one level. But each level represents a depth. Is it possible to get all levels?
I also do not understand the 3rd warning message: In .getCRSfromGridMap4(atts) : cannot process these parts of the CRS: epsg_code=EPSG:4326
I get a different result (0.5 for Jan level 1) but my colleague gets 1.4 for Jan level 1). Is my error due to the above warning?
#this works
Nit_Jan <- brick("~woa18_all_n01_01.nc", stopIfNotEqualSpaced =
FALSE, varname = "n_an", level = 1)
#this doesn't
Nit_Jan <- brick("~woa18_all_n01_01.nc", stopIfNotEqualSpaced =
FALSE, varname = "n_an", level = 1:43)
Warning messages:
1: In if (level <= 0) { :
the condition has length > 1 and only the first element will be used
2: In if (oldlevel != level) { :
the condition has length > 1 and only the first element will be used
3: In .getCRSfromGridMap4(atts) : cannot process these parts of the
CRS:epsg_code=EPSG:4326
I would like to plot nitrate by depth