nco
works fine, but just to list an alternative, one can also do it using cdo
(climate data operators), which I find easier to remember. You can specify directly the longitude and latitude values in this way:
cdo sellonlatbox,lon1,lon2,lat1,lat2 infile.nc outfile.nc
where lon1,lon2,lat1,lat2 define the boundaries of the area you require.
Note that longitude can be specified using 0:360 or also -180:180 conventions irrespective of that used in the input file. The output conventions will follow those used in the cdo command. This this command can also be used to convert a file from one format to the other.
For more details on extracting subregions, I have posted this video tutorial on youtube
If you don't have cdo
already installed you can get it on Ubuntu with
sudo apt-get install cdo
cdo
has many other functions for processing, combining and splitting files and an excellent online documentation. Note that for cdo
to work the coordinate variables (lat/lon) need to be defined according to CF conventions, so in that way the nco
solution is more robust.