Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>In the question you linked the whole part from <code>lat &lt;- rev(lat)</code> to <code>temp &lt;- t(temp)</code> was very specific to that particular OP dataset and have absolutely no universal value.</p> <pre><code>temp.nc &lt;- open.ncdf("~/Downloads/air.1999.nc") temp.nc [1] "file ~/Downloads/air.1999.nc has 4 dimensions:" [1] "lon Size: 144" [1] "lat Size: 73" [1] "level Size: 12" [1] "time Size: 365" [1] "------------------------" [1] "file ~/Downloads/air.1999.nc has 2 variables:" [1] "short air[lon,lat,level,time] Longname:Air temperature Missval:32767" [1] "short head[level,time] Longname:Missing Missval:NA" </code></pre> <p>As you can see from these informations, in your case, missing values are represented by the value <code>32767</code> so the following should be your first step:</p> <pre><code>temp &lt;- get.var.ncdf(temp.nc,"air") temp[temp=="32767"] &lt;- NA </code></pre> <p>Additionnaly in your case you have 4 dimensions to your data, not just 2, they are longitude, latitude, level (which I'm assuming represent the height) and time.</p> <pre><code>temp.nc$dim$lon$vals -&gt; lon temp.nc$dim$lat$vals -&gt; lat temp.nc$dim$time$vals -&gt; time temp.nc$dim$level$vals -&gt; lev </code></pre> <p>If you have a look at <code>lat</code> you see that the values are in reverse (which <code>image</code> will frown upon) so let's reverse them:</p> <pre><code>lat &lt;- rev(lat) temp &lt;- temp[, ncol(temp):1, , ] #lat being our dimension number 2 </code></pre> <p>Then the longitude is expressed from 0 to 360 which is not standard, it should be from -180 to 180 so let's change that:</p> <pre><code>lon &lt;- lon -180 </code></pre> <p>So now let's plot the data for a level of 1000 (i. e. the first one) and the first date:</p> <pre><code>temp11 &lt;- temp[ , , 1, 1] #Level is the third dimension and time the fourth. image(lon,lat,temp11) </code></pre> <p>And then let's superimpose a world map:</p> <pre><code>library(maptools) data(wrld_simpl) plot(wrld_simpl,add=TRUE) </code></pre> <p><img src="https://i.stack.imgur.com/Qagvv.png" alt="enter image description here"></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload