Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8492923
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T22:51:51+00:00 2026-06-10T22:51:51+00:00

I have a netcdf file that I would like to just visualize the soil

  • 0

I have a netcdf file that I would like to just visualize the soil depth map

   [1] "file C:\\Users\\SoilDepth-gswp.nc has 3 dimensions:"
     [1] "x   Size: 360"
     [1] "y   Size: 150"
     [1] "land   Size: 15238"
     [1] "------------------------"
     [1] "file C:\\SoilDepth-gswp.nc has 3 variables:"
     [1] "float nav_lon[x,y]  Longname:Longitude Missval:1e+30"
     [1] "float nav_lat[x,y]  Longname:Latitude Missval:1e+30"
     [1] "float SoilDepth[land]  Longname:Soil depth Missval:1.00000002004088e+20"

It seems that I have to connect the latitudes with longitudes as well as the land points to get a map of the soil depth.I am really confused .Can anyone help me with this kind of data.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T22:51:53+00:00Added an answer on June 10, 2026 at 10:51 pm
    library(ncdf)
    # I'm assuming this is the netcdf file you are working with:
    download.file("http://dods.ipsl.jussieu.fr/gswp/Fixed/SoilDepth.nc", destfile="SoilDepth.nc")
    soil <- open.ncdf("SoilDepth.nc")
    #The way to extract a variable is as following:
    soil$var[[3]] -> var3 # here, as shown in your question, SoilDepth is the 3rd variable
    get.var.ncdf(soil, var3) -> SoilDepth
    
    dim(SoilDepth)
    [1] 15238
    

    As was said in the summary for your netcdf file, the variable SoilDepth depends on dimension land only and not on x and y so I’m not sure where does that leave you when it comes to plotting this dataset.

    Edit

    It turns out there is a key that links x, y and land:

    download.file("http://dods.ipsl.jussieu.fr/gswp/Fixed/landmask_gswp.nc", destfile="landmask.nc")
    landmask <- open.ncdf("landmask.nc")
    landmask$var[[3]] -> varland
    get.var.ncdf(landmask, varland) -> land
    sum(land==1)
    [1] 15238
    

    So in order to plot:

    # The values where stored in an expected order, hence the transpose
    land = t(land)
    land[land==1] <- SoilDepth
    land[land==0] <- NA
    land = t(land)
    image(land)
    

    enter image description here

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a NetCDF file, which contains data representing total precipitation across the globe
I have an application I'm building that's using the NetCDF C++ library, and NetCDF
have such kind of error. When adding Redirect 301 rule to .htaccess file like:
I have a Windows Mobile application using the compact framework (NETCF) that I would
My co-workers would like to make sure that our work in R is platform-independent,
Have a procedure which looks like Procedure TestProc(TVar1, TVar2 : variant); Begin TVar1 :=
have a problem. At first look at this HTML <div id=map style=background-image: url(map.png); width:
Anyone out there have enough experience w/ NetCDF and HDF5 to give some pluses
I have a .NETCF project that I have been trying to convert from .NETCF
I am trying to create a multi-dimensional NetCDF file using the R package ncdf

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.