Ocean Modeling Discussion

ROMS/TOMS

Search for:
It is currently Sun Jul 21, 2019 9:34 am




Post new topic Reply to topic  [ 10 posts ] 

All times are UTC

Author Message
 Post subject: inverted mask
PostPosted: Fri Apr 21, 2017 9:00 pm 
Offline

Joined: Wed Sep 30, 2015 8:21 pm
Posts: 22
Location: Institute of Oceanology of Cuba
I am trying to generate a grid using pyroms but I keep getting the mask inverted

I've been using pyroms to generate grids North Caribean region without any problem,
any ideas of what could be wrong?

thanks in advance
Luis Sorinas


Attachments:
cepa_grid.png
cepa_grid.png [ 142.65 KiB | Viewed 4458 times ]
Top
 Profile  
Reply with quote  
 Post subject: Re: inverted mask
PostPosted: Fri Apr 21, 2017 9:18 pm 
Offline
User avatar

Joined: Wed Jul 02, 2003 5:29 pm
Posts: 3633
Location: IMS/UAF, USA
Yeah, I had that happen once too. Another way to set the land mask is with this package. He only sets the mask_rho variable so you need to set the u/v masks to be consistent with them - one way to do that is to fire up one of the editmask tools and let it do that.


Top
 Profile  
Reply with quote  
 Post subject: Re: inverted mask
PostPosted: Fri Apr 21, 2017 9:34 pm 
Offline

Joined: Wed Sep 30, 2015 8:21 pm
Posts: 22
Location: Institute of Oceanology of Cuba
thanks a lot Kate, it seems like a great tool
I will try it

I have another pyroms question, perhaps is more about opendap
I am tying to use pyroms to download hycoms ncoda 1/12 data base on the Palau Exmple script, perhaps my question is silly but I cannot find in Hycoms data server a link to the data that pyroms understand
for example
in your Palau Hycom get_hycom_GLBa0.08_Palau_grid.py you donwload data from
http://tds.hycom.org/thredds/dodsC/data ... _00_3zt.nc

but when I try to download it thi is the link I get from hycom data server
http://tds.hycom.org/thredds/dodsC/GLBa ... temp?Depth[0:1:32]

where can I ind data that en in something like archv.2015_001_00_3zt.nc

regards

Luis


Top
 Profile  
Reply with quote  
 Post subject: Re: inverted mask
PostPosted: Fri Apr 21, 2017 9:50 pm 
Offline
User avatar

Joined: Wed Jul 02, 2003 5:29 pm
Posts: 3633
Location: IMS/UAF, USA
Weird, the HYCOM tab in my browser points to http://tds.hycom.org/thredds/dodsC/datasets/GLBa0.08/expt_91.2/2017/2d/catalog.html which now gives an error. Obviously it was working earlier this year. Anyone know where to look for it now?


Top
 Profile  
Reply with quote  
 Post subject: Re: inverted mask
PostPosted: Mon Apr 24, 2017 6:12 pm 
Offline

Joined: Mon Dec 05, 2011 3:29 pm
Posts: 7
Location: Instituto de oceanolodia(IDO)
Hi
About the inverted mask, i think i have a solution or at least it work for me.
Instead of using map.coastsegs for the polygons i use map.coastpolygons, something like this:
for xx,yy in map.coastpolygons:
xa = np.array(xx, np.float32)
ya = np.array(yy,np.float32)
vv = np.zeros((xa.shape[0],2))
vv[:, 0] = xa
vv[:, 1] = ya
hgrd.mask_polygon(vv,mask_value=0)


Top
 Profile  
Reply with quote  
 Post subject: Re: inverted mask
PostPosted: Mon Apr 24, 2017 6:25 pm 
Offline
User avatar

Joined: Wed Jul 02, 2003 5:29 pm
Posts: 3633
Location: IMS/UAF, USA
Cool, thanks!


Top
 Profile  
Reply with quote  
 Post subject: Re: inverted mask
PostPosted: Wed Apr 26, 2017 11:11 am 
Offline

Joined: Mon Jul 04, 2016 1:31 pm
Posts: 12
Location: University of the Aegean, GR
I am guessing that the source of this, is in the way the code 'jumps' from an open coast segment to the next.
When a shoreline is interrupted by the Basemap function, the topology changes and so does the distinction between land and water.

When I ran into a similar situation, I solved it by declaring the initial Basemap function without borders (i.e. the whole world - no lonmax, latmax etc.):

Code:
map = Basemap(projection='merc',resolution='i')


In this way pygridgen gets all the topological information of where land stops.

Stamatis


Top
 Profile  
Reply with quote  
 Post subject: Re: inverted mask
PostPosted: Fri May 26, 2017 3:16 am 
Offline

Joined: Wed Apr 26, 2017 5:23 pm
Posts: 15
Location: Sun Yat-sen University
Hi, Luis and Kate, have you solved the problem about url?
Several days ago, I have successed downloading some data from the url like http://tds.hycom.org/thredds/dodsC/datasets/GLBa0.08/expt_91.1/2015/salt/archv.2015_001_00_3zs.nc. However, when I use the same script to download data today,it gives me the message:
Code:
syntax error, unexpected $end, expecting SCAN_ATTR or SCAN_DATASET or SCAN_ERROR
context: ^
Traceback (most recent call last):
  File "get_hycom_GLBa0.08_salt_2015.py", line 76, in <module>
    dataset = netCDF4.Dataset(url)
  File "netCDF4/_netCDF4.pyx", line 1848, in netCDF4._netCDF4.Dataset.__init__ (netCDF4/_netCDF4.c:13983)
OSError: NetCDF: Malformed or inaccessible DAP DDS


It means the opendap url is inaccessible, right? Do you have any suggestions for me?
Thank you very much.


Top
 Profile  
Reply with quote  
 Post subject: Re: inverted mask
PostPosted: Fri May 26, 2017 4:25 am 
Offline
User avatar

Joined: Wed Jul 02, 2003 5:29 pm
Posts: 3633
Location: IMS/UAF, USA
I couldn't get files either a few weeks back. Perhaps they are having server issues. Why don't you contact the HYCOM people directly?


Top
 Profile  
Reply with quote  
 Post subject: Re: inverted mask
PostPosted: Fri May 26, 2017 5:28 am 
Offline

Joined: Wed Apr 26, 2017 5:23 pm
Posts: 15
Location: Sun Yat-sen University
Ok,thank you.


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 10 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group