Scheduled Downtime
On Friday 21 April 2023 @ 5pm MT, this website will be down for maintenance and expected to return online the morning of 24 April 2023 at the latest

Metgrid error.

Alex33

New member
Hello.

I changed the LANDMASK of the geogrid netcdf to one I created separately. When I run metgrid I get the following error: In read_next_field(), problems with ext_pkg_get_var_info() in metgrid log file.

Do you know how I can fix it?

I modified the LANDMASK since it was not correct for the files that I am using and they gave me wrong simulations.


Regards
 
I believe this error indicates the program is unable to recognize the file format of the data. When you modified LANDMASK, did it change the geo_em* file format? Are you able to open the geo_em* file(s) with ncview, or to issue and ncdump on the file?
 
I believe this error indicates the program is unable to recognize the file format of the data. When you modified LANDMASK, did it change the geo_em* file format? Are you able to open the geo_em* file(s) with ncview, or to issue and ncdump on the file?
Hello, I'm facing the same problem. When I open the modified geo_em_d02 data, it has the exact same format as the original data.
 
@xiett
Can you provide more information about your issue. What are you modifying, and what is the "original data" you refer to in your post? Are you receiving an error when running metgrid? If so, can you attach the metgrid.log file to show the error? Thanks!
 
Hello. I am also facing the same problem.
I want to use USGS 30s data for my simulation, but it underestimates the urban area in my study region (Dhaka), as checked from the geogrid file. So I ran geogrid.exe with 'modis_landuse_20class_30s_with_lakes' as default in GEOGRID.TBL, which gave me a more accurate urban grid. I extracted those urban points from geogrid(modis) and changed the values of the same points in geogrid(usgs) file to 33 [Note that geogrid(modis) indicates geo_em.d04.nc file created using modis landuse type; geogrid(usgs) indicates geo_em.d04.nc file created using usgs landuse type]. After modifying in such way and using geogrid(usgs) to run metgrid, it says

Processing domain 1 of 4
ERROR: In read_next_field(), problems with ext_pkg_get_var_info()
[unset]: aborting job:
application called MPI_Abort(MPI_COMM_WORLD, 0) - process 0

The modified geogrid file has the same file format as the geogrid files created after running geogrid.exe.
 
@abeda
Are you able to use Ncview to view, or ncdump to read your modified geo_em* file?
Yes, I can use ncview and ncdump. But metgrid doesn't run. It seems saving the geo_em files as a new file makes the problem. I modified the LU_INDEX variable in the geo_em files instead, and it ran well.
 
@Ruhee
Practically, how did you solve this problem?


I modified my LU_INDEX using xarray in python and I am getting the same error as you were getting i.e: ERROR: In read_next_field(), problems with ext_pkg_get_var_info()


This is how I am doing the editing with xarray in python as below


## read the geogrid file
ds_NOURB = xr.open_dataset( "geo_em.d03.nc" )
## edit the LU_INDEX
ds_NOURB['LU_INDEX'] = xr.where((ds_NOURB['LU_INDEX'] == 13 ), 10 , ds_NOURB['LU_INDEX'])
##
ds_NOURB.to_netcdf( "geo_em.d03.nc" ) # doesnt overwriting. have to del og and then save
 
@Ruhee
Practically, how did you solve this problem?


I modified my LU_INDEX using xarray in python and I am getting the same error as you were getting i.e: ERROR: In read_next_field(), problems with ext_pkg_get_var_info()


This is how I am doing the editing with xarray in python as below


## read the geogrid file
ds_NOURB = xr.open_dataset( "geo_em.d03.nc" )
## edit the LU_INDEX
ds_NOURB['LU_INDEX'] = xr.where((ds_NOURB['LU_INDEX'] == 13 ), 10 , ds_NOURB['LU_INDEX'])
##
ds_NOURB.to_netcdf( "geo_em.d03.nc" ) # doesnt overwriting. have to del og and then save
Hi. I am very new to WRF model, and solved it with the help of my seniors. I will try to explain what I understand.

To simply put, the geogrid files that are created after running geogrid.exe have some specific 'settings' (i'm not sure if 'settings' is the proper word though) that are required for the next runs. When we modify geogrid and save it as a new file, then those specific 'settings' are not saved in the new file. As a result when we try to run metgrid, because of those missing 'settings', we get the error.

The solution is to modify the geogrid file itself without saving into a new file. In this case, we are only changing what we want to change and all the other 'settings' are remained.

I used ncl code to modify the geogrid file. My geogrid file has dimensions of (1,185,185) (time, x,y).

Firstly, in the geogrid (modis) file, we have some indexes in each dimension that fall under the urban landuse type (13 in modis). I selected those indexes from each dimension and saved them as an array. Then, in geogrid(usgs) file I only changed the values of those indexes to 33 (urban landuse in usgs). This way, I only modified the original geogrid(usgs) without saving to a new file.


This is a simple do loop i used to select the indexes from the modis file.
k_idx_urb = new(711,"integer") #711 is an approximate number of the total grids under urban land use
i_idx_urb = new(711,"integer")
j_idx_urb = new(711,"integer")
urb_num = 0
do k = 0,0
do i=0,185
do j = 0,185
if (LU_INDEX(k,i,j).eq.13) then
k_idx_urb(urb_num) = k
i_idx_urb(urb_num) = i
j_idx_urb(urb_num) = j
urb_num = urb_num + 1
end if
end do
end do
end do


Hope this helps!
 
Hi all:

I recently ran into a similar issue when running metgrid where I would get the message In read_next_field(), problems with ext_pkg_get_var_info() as well. I was able to figure out my issue and figured I'd share my solution in case others run into this problem in the future.

I modified my geo_em file in order to change the terrain. I did this using xarray in python as you can see below, where I chaged the HGT_M variable using my own data, which I call terr_interp in python:

Python:
geo_ds['HGT_M'] = (('Time', 'sout_north', 'west_east'), terr_interp)

The problem with doing this is that it removes the data attributes from the netcdf file. So when reassigning the variable, it is essential to also make sure you specify the attributes:

Python:
HGT_attrs = geo_ds.HGT_M.attrs # Extract the attributes for the variable
# Replace the HGT_M variable with the updated terrain
geo_ds['HGT_M'] = (('Time', 'sout_north', 'west_east'), terr_interp)
geo_ds['HGT_M'].attrs.update(HGT_attrs) # This line about the attributes is very important. Without it, metgrid will not work

With the attributes specified, you can simply save the geo_em file to a netcdf and metgrid works properly.

Hope this helps!
 
Top