[NARCCAP-discuss] epsg value for CRCM-cgcm3 model
Jianhua Huang
jh.eco.cas at gmail.com
Tue Nov 12 22:17:38 MST 2013
Hi Oleksandr:
Thanks much for the projection information. That is a perfect projection.
Regarding your question about the R code, if you just want to plot the netcdf directly, you can use the image() function.
Taking the 3-hourly temperature data from CRCM-cgcm3 model as an example:
nc <- open.ncdf('tas_CRCM_cgcm3_1991010103.nc') # read the metadata for the netcdf file
tas <- get.var.ncdf(nc, 'tas', count = c(140, 115, 1)) # extract the data you want
image(tas) #this will show you the figure
For my purpose, I need to extract the data for the United States, and display it with projection. The code looks like this:
library(ggplot2)
grid <- read.csv('grid.example.csv')
ggplot(data = grid, aes(lon.proj, lat.proj, colour = sub_ac_ctr_col), asp = 1) +
geom_point(shape = 15, size = 3) +
scale_colour_manual(name = 'Legend', values = sapply(6:0/18, hsv)) +
theme_set(theme_gray(base_size = 18)) +
guides(col = guide_legend(reverse=TRUE)) + ## used to reverse the legends
ggtitle('Title')
The grid.example.csv file and the output figure are attached.
Jianhua
-----Original Message-----
From: narccap-discuss-bounces at mailman.ucar.edu [mailto:narccap-discuss-bounces at mailman.ucar.edu] On Behalf Of Oleksandr Huziy
Sent: Tuesday, November 12, 2013 11:26 AM
To: Discussion of NARCCAP data - uses and questions
Subject: Re: [NARCCAP-discuss] epsg value for CRCM-cgcm3 model
Try using this one:
'+lon_0=263.0 +lat_ts=90.0 +R=6370997.0 +proj=stere +x_0=10691802.4659
+units=m +y_0=10691802.4659 +lat_0=90.0 '
This one was plotted using the above projection.
[image: Images intégrées 1]
2013/11/12 Oleksandr Huziy <guziy.sasha at gmail.com>
> Ah, no, sorry, I've messed up, the one there is not latlon, it is
> rotated north polar stereographic (smth like that)...
> sorry for the confusion...
>
> Cheers
>
>
> 2013/11/12 Oleksandr Huziy <guziy.sasha at gmail.com>
>
>> Hi Jianhua:
>>
>> It is rotated lat/lon, the proj4string is smth like this:
>> +o_proj=longlat +lon_0=<your true pole longitude in this crs>-180
>> +o_lat_p=<your true pole latitude> +R=6370997.0 +proj=ob_tran
>> ++units=m o_lon_p=<longitude of the rotated pole in the true lat/lon>
>>
>>
>> those things in <> could be found in the header of the netcdf file.
>>
>> Can you show me your plotting code? I've never done it in R, though
>> tried, and abandoned, seems to complicated))
>>
>> It would be great to have a working example code with data attached
>> to it (just one field for one time step)
>>
>> thanks
>>
>> Cheers
>>
>>
>>
>> 2013/11/11 Jianhua Huang <jh.eco.cas at gmail.com>
>>
>>> Hi:
>>>
>>>
>>>
>>> I am trying to plot the netcdf file from CRCM-cgcm3 in R. There are
>>> some gaps between the grid cells when I used "+proj=longlat
>>> +datum=WGS84" as projection. When I transfer the projection with the
>>> following function, it improves a little.
>>>
>>>
>>>
>>> sp.grid.proj <- spTransform(sp.grid, CRS('+init=epsg:3979'))
>>>
>>>
>>>
>>> Unfortunately, I don't know the exact epsg value I should for the
>>> CRCM-cgcm3
>>> model. Thank for any suggestion.
>>>
>>>
>>>
>>> Jianhua
>>>
>>> _______________________________________________
>>> narccap-discuss mailing list
>>> narccap-discuss at mailman.ucar.edu
>>> http://mailman.ucar.edu/mailman/listinfo/narccap-discuss
>>>
>>
>>
>>
>> --
>> Sasha
>>
>
>
>
> --
> Sasha
>
--
Sasha
-------------- next part --------------
A non-text attachment was scrubbed...
Name: grid.example.csv
Type: application/vnd.ms-excel
Size: 343681 bytes
Desc: not available
Url : http://mailman.ucar.edu/pipermail/narccap-discuss/attachments/20131112/da3bc771/attachment-0001.xlb
-------------- next part --------------
A non-text attachment was scrubbed...
Name: grid.example.png
Type: image/png
Size: 10757 bytes
Desc: not available
Url : http://mailman.ucar.edu/pipermail/narccap-discuss/attachments/20131112/da3bc771/attachment-0001.png
More information about the narccap-discuss
mailing list