Hey there,
I have a question concerning the option -extents..
If I use the script wrfvdfcreate there is a .vdf file created that includes data of my wrf - file; one information will be the extents - value e.g. :
-4441114.671937881 2628030.834958459 -225.4647827148438 4441114.671937882 9978620.552037448 15084.2275390625
This one will determine where my plot will take place, right? (It should be Europe)
But now, if I want to plot another netcdf - data that I cannot import directly (like WRF))into Vapor I need to convert it to .vdf by using ncdfvdfcreate. Here I need to give some options.
One would be the extents - value but where do I find those values and how are they related to my netcdf file?
To visualize georeferenced data in VAPOR the data must be projected from geographical coordinates into a Projected Coordinate System (PCS) using one of the mapping projections that VAPOR understands. Vaporgui will perform the projection for you, but you must put a Proj4 style projection string inside of the .vdf file (you can use the -mapprojection command line option for ncdfcreate), and you must calculate the extents of your data in the PCS system. Vaporgui supports all of the map projections used by WRF. If you have WRF data you might want to look at the projection string that is automatically created by the wrfvdfcreate command.
Please let us know if you need furhter help.
You need find the minimum and maximum extents of your projected data in PCS space. One option is to use the 'cs2cs' command line utility that comes with the Proj4 package. The command will convert between PCS and geographic coordinates given a user defined projection string. Another option is to use GDAL, which is the successor to Proj4. However, I don't have much experience with GDAL, and can't point you to a particular tool.
Admittedly, this is a pretty tedious and non-intuitive process. We are continuing to add better support for georeferenced data in VAPOR. If you have any flexibility with writing your output files targetting CF compliant NetCDF in the future will be helpful.
cheers - jc
Hey,
I tried to use cs2cs but for me it is actually a bit hard to understand the syntax etc., because I am a beginner in this topic..
Do You know how to use it?
I need to specify certain coordinate systems and also projections strings, don't I?
But how do I know how this string looks like?
My current problem is that I have a netCDF file that I want to display in Vapor but I need to specify extent values.(I am using ncdfvdfcreate)
I think that I receive those by using cs2cs because my coordinates are saved in decimals (11.456 -88.354 55.1465 13.441 something like this).
I also tried to display WRF data of the same area in Vapor and here wrfvdfcreate created a .vdf file with extent values and a projection string ("+proj=lcc +lon_0=12.5 +lat_1=30 +lat_2=60 +ellps=WGS84").
So referring to the WRF case, does the script convert the decimal coordinates stored in the WRF data into values that can be projected by declaring a projection string?
I really do not know how to explain this exactly but I hope You can help me.
Michael
Hi Michael,
Let's walk through an example that I think will do what you want to do. Let's assume that your data are on a lat-lon grid, with the south-west corner having lon=40, and lat=40; and the north-east corner having lon=50, lat=50. A good choice for a Proj4 map projection string would be:
+proj=eqc +ellps=WGS84 +lon_0=45 +lat_0=45.0
because it centers the projection - puts the origin in Projected Coordinate System coordinates - at 0,0
To compute the extents that VAPOR wants in PCS coordiantes (e.g. meters on the ground) you would run the command:
cs2cs +proj=latlong +datum=WGS84 +to +proj=eqc +ellps=WGS84 +lon_0=45 +lat_0=45.0
and then give it the south-west coordinates 40, 40, and north-east coordinates: 50,50 on standard input:
When I do this I get:
cs2cs +proj=latlong +datum=WGS84 +to +proj=eqc +ellps=WGS84 +lon_0=45 +lat_0=45.0
40 40
-556597.45 -556597.45 0.00
50 50
556597.45 556597.45 0.00
Hence, -556597.45 -556597.45 would be the minimum extents that VAPOR wants, and 556597.45 556597.45 would be the maximum extents (ignore the third, 0.00 coordinate). To then construct a .vdf file with ncdfvdfcreate you would do something like:
ncdfvercreate -extents -556597.45:-556597.45:zmin:556597.45:556597.45:zmax ...
where zmin and zmax are the vertical coordinates in meters.
Hope this helps!
Great. Let us know if you have any more trouble.
jc