[ncl-talk] NCL cannot work with variable within NetCDF file (WRF)
Brock Tropea
brockt.1337 at gmail.com
Fri Oct 12 14:00:57 MDT 2018
Hi there,
A little context is required. Working with this dataset:
https://rda.ucar.edu/datasets/ds612.0/#access
The output is not standard WRF (where all variables are in a single NetCDF
file for an hour), rather each variable gets its own NetCDF file. In this
case, the data is every 3 hours for 1 day (8 timesteps per file/24 hours/1
day). This has caused me nothing but headaches with NCL, however I managed
to fiddle with some sample scripts to make them work, somewhat.
I have a semi-functional program that is looking at a vertical cross
section of temperature (as a filled contour) and U component wind as
vectors. I found a script online that someone made for a similar purpose,
and have modified it to make it work with my data (somewhat).
The problem I'm now having is that NCL doesn't seem to see a variable
within one of the files. The section of code in question is intended to
plot a line across a map of the WRF terrain field, to show where the
subsequent cross section is. If I remove the block of code from the
program, it works, and it generates the attached image.
Specifically, NCL fails when it tries to locate "XLAT" within the
"terfile", which is a constants file that holds the terrain data. However
the variable is there, I have checked with ncl_filedump.
What I THINK it is having an issue with is the fact that within that file,
the XLAT variable is only 2 dimensional. It only has spatial dims, no time
dim. wrf_user_getvar has 3 inputs, with the last one being the time. I have
tried putting in 0, -1, and nothing and none of them work. I have tried
using the XLAT from another file(ie:tkfile) which is also 2D, but that
doesn't help. Exact error is:
"fatal:Number of subscripts do not match number of dimensions of variable,
(3) subscripts used, (2) subscripts expected
fatal:["Execute.c":6381]:variable (XLAT) is not in file (in_file)
fatal:["Execute.c":8640]:Execute: Error occurred at or near line 4122 in
file $NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl
fatal:["Execute.c":8640]:Execute: Error occurred at or near line 4223 in
file $NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl
fatal:["Execute.c":8640]:Execute: Error occurred at or near line 4306 in
file $NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl
fatal:["Execute.c":8640]:Execute: Error occurred at or near line 290 in
file vertcrossvectortest2.ncl
[umtropea at tatanka vertical_cross]$ "
Is there any way to tweak this to get it working?
Keep in mind this is a WIP and I haven't gotten the A to B aspect working
just yet, among other things. I'd like to focus on the error at hand.
I've attached the script file, image of the plot generated when I remove
the broken portion, and the filedump of XLAT as text.
I'm running on CentOS 6.8, NCL version 6.4.0.
Apologies for the long message, wanted to be specific.
Thanks to anyone who might have some insight on this.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20181012/5b418fd7/attachment.html>
-------------- next part --------------
The ncl_filedump from the constants file, "terfile".
Variable: XLAT
Type: float
Total Size: 1379385 values
5517540 bytes
Number of Dimensions: 2
Dimensions and sizes: [ 1015 <south_north> x 1359 <west_east> ]
Chunking Info: [ 508 <south_north> x 680 <west_east> ]
Coordinates:
Number of Attributes: 7
FieldType : 104
MemoryOrder : XY
description : LATITUDE, SOUTH IS NEGATIVE
units : degree_north
stagger :
long_name : LATITUDE, SOUTH IS NEGATIVE
cell_methods : Time: mean
-------------- next part --------------
A non-text attachment was scrubbed...
Name: vertcross.png
Type: image/png
Size: 280231 bytes
Desc: not available
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20181012/5b418fd7/attachment.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: vertcrossvectortest2.ncl
Type: application/octet-stream
Size: 11232 bytes
Desc: not available
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20181012/5b418fd7/attachment.obj>
More information about the ncl-talk
mailing list