How I’ve Been Processing Climate Data

From a THREDDS server, I’m using the NetcdfSubset portal to obtain a spatial subset of my climate data set of interest. Since the files I need are too big to download from their HTTP server, they instead give me an OPeNDAP URI with the spatial subset info. I then pass that to nccopy from the NetCDF library.

Then, I installed CDO and wrote a script to do the monthly means for all the files: it averages a daily time step file into a monthly averaged (or whatever metric you choose) file.

cdo monmean

Then, I installed nco to flip the axes.

ncpdq -a lat,lon

Then, I imported the correctly-oriented files into R.

rm(list = ls())
setwd("wherever your files are")
climate <- brick("",varname="whatever your climate variable is")

In my case, as I think is common for climate files, longitude was on a 0-360 scale, instead of -180/180.

And Now for a Windows Hack in a Pinch…

For reasons I won’t describe here, I had to quickly install nco on Windows, and figure out how to use the command line to loop over files in a given directory. So, I navigated to the folder where I have nco on the command line, and ran this to loop over the files in my climate folder.

for /r %i in "C:\Users\me\myfolder" do ncpdq -a lat,lon %i

Projecting NetCDF Files as Raster Bricks

I need to change the projections of the NetCDF files, so I have read one into R and have been trying to manipulate it there.

f <- file.path("C:/nco/")
tmin <- brick(f,varname="tmin")
Albers <- "+proj=aea +lat_1=29.5 +lat_2=45.5 +lat_0=23 +lon_0=-96 +x_0=0 +y_0=0 +ellps=GRS80 +datum=NAD83 +units=m +no_defs"
proj1 <- projectRaster(tmin,crs=Albers)

Invariably, this leads to a blank raster, where all the values have been replaced with NA. So, something is wrong: I’m trying to maybe put something into the wrong space where it’s not fitting/lining up? A few things that also make me wonder what’s wrong…

  • it can’t rotate (raster::rotate gives me an error saying it doesn’t “look like an appropriate object for this function”)
  • a function like raster(inputfile, varname="lat")doesn’t work; when I try that, it says that “lat” is not a variable (though it’s a dimension for the actual variable of interest, “tmin” in this case, which seems to work for other intents and purposes).


  • use gdalwarp instead to project the NetCDF?
  • after projecting, make the shape file line up to 0-360 coordinates?

Spatially Manipulating NetCDF Files

I ended up getting a bunch of climate NetCDF files from a colleague for each combination of climate model, climate change scenario and variable. So, what I have is a list of 3-D files consisting of observations/predictions of a given weather variable over latitude, longitude and time (you can picture them as cubes, if you like). I will need to spatially adjust the files, and then subset the data.

ncpdq -a lat,lon

I need to…

  • keep only the extent within a shape file we’re using
  • figure out how to summarize it by the polygons in the shape file
    • average?
    • keep only the center point?

Some of my closest colleagues, Brooke Bateman and Andy Allstadt, had some good advice for how to work with the netCDF files in R once I get them:

  • ncdf4 package
  • raster package: can open netCDF either as…
    • single layer (with the raster function)
    • the entire thing (brick function)
  • SDMTools
    • sample x,y points from raster using extract data function
    • convert the raster to ASCII

You can load those libraries, and then do a few things to take a look.

library(<span class="pl-smi">raster</span>)
print(raster(<span class="pl-s"><span class="pl-pds">"</span><span class="pl-pds">"</span></span>))  <span class="pl-c">## same as 'ncdump -h</span>
b <- brick(<span class="pl-s"><span class="pl-pds">"</span><span class="pl-pds">"</span></span>, <span class="pl-v">varname</span> <span class="pl-k">=</span> <span class="pl-s"><span class="pl-pds">"</span>pr<span class="pl-pds">"</span></span>) #this is the variable name internal to the file

MN Ornithologists’ Union Young Birders’ Committee

I’m pleased to have been asked to serve on the MOU Young Birders’ Committee! We’re generously defining “young” as 18-40, but not without precedent (Erikson 1963). Our overarching goal is to improve participation of those of us in this age group in conservation-related organizations, which in our specific case is MOU. Conveniently, my friend who chairs this committee did his thesis on the topic! He studied how young birder participation in clubs differs from that of previous generations, and I resonate with his core findings. With this growing demographic in birding, it will be important to address the needs of young birders within organizations in order to fully engage the community of interest.

Getting Started: Learning How to Watch Birds


As with any skill, there’s a certain element to “learning how to learn” to observe birds. You’ll see what I mean if you invest time in this new hobby. You start to learn what marks to look for and where to look, or how to listen. You pick up how to watch and anticipate movements, and what’s an important feature to try to gather information. Learning how to learn bird song was especially a notable process for me, because I’m not a natural “by ear” learner, and I’d venture to say most aren’t. Those with musical backgrounds might have more developed skills in this arena, but this is where the concept of “meta-learning” really stuck out to me as I tried to learn more about birds. I not only memorized songs (often via mnemonics), but eventually I learned how to listen.

Different Styles

To follow up on that, there are different learning styles that resonate with different people, so I’d highly recommend you try to learn more about “how you learn” as you think about how to approach this new skill, and it’s not just visual vs. verbal! There are 7 styles that also interact. The most commonly referenced way to learn often involves getting a field guide, but that’s not the best strategy for everyone. Here are my thoughts in relation to the learning styles, though for anyone it might be best to try several of these strategies in tandem!

  • Visual (most common, and thus this strategy is most commonly referenced): Get a quality field guide
  • Aural (consider yourself lucky! you’re well-suited to learning bird songs): Check out an audio guide to learning how to listen to birds
  • Verbal: Go out on a local field trip led by an expert
  • Physical: Look for animal rehab centers or natural areas in your area that offer demonstrations that will allow you to see birds up close. It will be a rewarding experience if you’re able to attend an event where live birds are captured for research, that you can see in the hand before they’re released!
    • This one is a little harder to give general advice on, because only certain places do this, and often only certain times of the year. Start by searching for bird observatories in your area, and keep up with event calendars for nearby natural areas that, e.g., have welcome centers and related organizations.
  • Logical: consider first learning about birds (e.g. taxonomy) and how the topological characteristics follow
    • Certain field guides are organized by taxonomy (though schemes differ). It may help you to understand how birds are classified, along with perhaps theories of how they evolved to those places, and thus what characteristics belong to each to give you a base of information to which you can attach bird species IDs.
  • Social: join a local bird club
    • Most bird organizations have a social media presence, so start by searching for your state’s bird club online and follow along through posts for opportunities to get involved in the community!
  • Solitary: spend some quiet time outdoors looking and listening (not much more explanation needed!)

These learning styles can occur in tandem; for example, if you’re a verbal learner, you may well be a social learner as well. So, consider which strategies most appeal to you and get out there observing birds! It’s easy and fun to get started!

My Annoying Climate Download Process

Here’s a summary of my week: I needed mass amounts of data from the NetcdfSubset portal, but it was too much for the HTTP server to handle (they set a cap) with just selecting the products and spatial extent to download. So, instead they returned to me a URI that needed to be passed through an external program, nccopy, to download the data. I wrote a script that separated the URI into separate files by model and scenario, and thus automated the download to save each combination of model, scenario and variable into separate NetCDF files.

The problem became that the download was really slow, owing to traffic here on my work network. Since there was no file size estimate given to me, I assumed maybe the files were huge. So, I did some internal compression to get them to download faster, but at the expense of read access speed for the files. Once I realized it wasn’t the file size, I redid the request for the files without chunking. I then had to kill that request to tailor the data acquisition for our needs, so I finally got all the temperature files today.

Then, I installed CDO and wrote a script to do the monthly means for all the files: it averages a daily time step file into a monthly averaged (or whatever metric you choose) file. I got a list of the base file names as such:

cat climate_structure | cut -d . -f1 > climate_models

Then  I wrote this simple bash script to loop over them all and write out the monthly averages:

while read climate_model; do
 echo "Now averaging $climate_model"
 cdo monmean ${climate_model}.nc ${climate_model}
done < climate_models