Weights file

General scientific issues regarding ROMS

Moderators: arango, robertson

Post Reply
Message
Author
hpftcb
Posts: 30
Joined: Wed Apr 13, 2016 7:37 pm
Location: OceanPact

Weights file

#1 Unread post by hpftcb »

Hi all,
I am trying to generate boundary file from HYCOM-NCODA data using as background pyroms/examples. My grid was generate through Seagrid. The problem is I get an error while this process, which I think is probably related with the weight file ("wts_file"). The question: how do I get this file? Is this file really necessary to generate Bry files from HYCOM ?
Just another brief question: Why does some people use Cli and Bry files at the same input file (ocean.in)? Are not Climatology and Bry different methodologies?

Thanks in advance.

Fernando Tulio Camilo Barreto

User avatar
kate
Posts: 4088
Joined: Wed Jul 02, 2003 5:29 pm
Location: CFOS/UAF, USA

Re: Weights file

#2 Unread post by kate »

In all of the interpolating, you need to run "python make_remap_weights_file.py" before creating the boundary files. I thought I wrote that somewhere, but it's not in the examples/README.

I always start with just the boundary files and not the climatology nudging. Then, depending on the quality of the boundary results, I might decide to resort to the climatology nudging as well. It just depends on the domain and the boundary file used. Some combinations result in strong boundary currents, some don't. I'm talking about unsightly currents along the domain boundary in the open ocean.

hpftcb
Posts: 30
Joined: Wed Apr 13, 2016 7:37 pm
Location: OceanPact

Re: Weights file

#3 Unread post by hpftcb »

Thank you, I managed to generate the weight files.
During make_bdry I got the following error in the temperature part:
''ValueError: operands could not be broadcast together with shapes (117,124) (119,126)''

I tracked down the error as belonging to flood_fast.py in the following part:

if kk == 0:
c3 = np.ones(mask.shape).astype(bool)
else:
c3 = np.isnan(varz[max(k-kk,0),:,:]) == 0
c = c1 & c2 & c3

It enters in else.

The numbers are related with my HYCOM file (I am using reanalysis), which presents the dimension
Dimensions:
MT = 1
Y = 119
X = 126
Depth = 33

Do you have any idea of this error's cause. Should my input Hycom file be square, or something like that?

Thank you a lot

fagundesmo
Posts: 51
Joined: Wed Dec 03, 2014 1:46 am
Location: University of Georgia

Re: Weights file

#4 Unread post by fagundesmo »

Hi Fernando,

this error is more related to python. If you quickly take a look you'll see that your HYCOM data domain is bigger than your grid/mask_rho maybe. I am not sure what domain has the shape (117,124), but try to re-run this command and always make the command name_of_your_array.shape() to see if at least in the flood part they have the same shapes. I hope this help a bit.

Cheers,

Matheus

hpftcb
Posts: 30
Joined: Wed Apr 13, 2016 7:37 pm
Location: OceanPact

Re: Weights file

#5 Unread post by hpftcb »

Hi Matheus, thanks a lot for your reply.
After checking the flood_fast.py file In realized that 4 2d arrays are generated in the section, MASK, C1, C2, C3. The shape of C2 and C3 is 119-126 (equal Hycom's), although the shape of MASK and C1 is 117-124, which causes the error. I set MASK and C1 to C2, which solved my problem (The files were generated). However the results are not correct, of course, since I spoiled mask. What I've gotta do now is to increase the dimension o MASK (from 117-124 to 119-126). I think it is my only way out, I really have no idea of the reason why MASK is being generated with -2 points in each dimension (C1 is created from MASK)

Thanks a lot,

Fernando T C Barreto

fagundesmo
Posts: 51
Joined: Wed Dec 03, 2014 1:46 am
Location: University of Georgia

Re: Weights file

#6 Unread post by fagundesmo »

Hi Fernando,

it will seem a dumb question but have you interpolated first the temp data to your grid?

Matheus

joaob

Re: Weights file

#7 Unread post by joaob »

Hi Fernando,

I had the same problem with the c1, c2 and c3 arrays and I found that when you create the HYCOM grid with the get_hycom_GLBa0.08_grid script, you have to do it with two more nodes than those you actually need, because, for some reason, the longitude and latitude vector that is used in the weights calculations and remapping only uses the interior grid nodes.

If you check get_hycom_GLBa0.08_grid that is in the examples/Arctic_HYCOM you'll see that the grid is using the following:

lon = dataset.variables['Longitude'][2100-1:,550-1:4040+1]
lat = dataset.variables['Latitude'][2100-1:,550-1:4040+1]

But in the get_hycom_GLBa0.08_temp the grid is defined using:

lon = dataset.variables['Longitude'][2100:,550:4040]
lat = dataset.variables['Latitude'][2100:,550:4040]

So the temp, salt, etc grid use only the interior points of the HYCOM grid.

Hope this helps,
Joao

hpftcb
Posts: 30
Joined: Wed Apr 13, 2016 7:37 pm
Location: OceanPact

Re: Weights file

#8 Unread post by hpftcb »

Hi João,
thanks a lot for your help. Sorry for the late reply, I was working in other projects and completely forgot the thread.
You are completely right,
Thank you

Regards,

Fernando.

WANGQIAN
Posts: 8
Joined: Tue Aug 22, 2017 5:38 pm
Location: Second Institute of Oceanography

Re: Weights file

#9 Unread post by WANGQIAN »

joaob wrote:Hi Fernando,

I had the same problem with the c1, c2 and c3 arrays and I found that when you create the HYCOM grid with the get_hycom_GLBa0.08_grid script, you have to do it with two more nodes than those you actually need, because, for some reason, the longitude and latitude vector that is used in the weights calculations and remapping only uses the interior grid nodes.

If you check get_hycom_GLBa0.08_grid that is in the examples/Arctic_HYCOM you'll see that the grid is using the following:

lon = dataset.variables['Longitude'][2100-1:,550-1:4040+1]
lat = dataset.variables['Latitude'][2100-1:,550-1:4040+1]

But in the get_hycom_GLBa0.08_temp the grid is defined using:

lon = dataset.variables['Longitude'][2100:,550:4040]
lat = dataset.variables['Latitude'][2100:,550:4040]

So the temp, salt, etc grid use only the interior points of the HYCOM grid.

Hope this helps,
Joao
Hi Joao,
you also help me when I make weight file ,thank you very much! :D

WangQian

Post Reply