inverted mask

Discussion about analysis, visualization, and collaboration tools and techniques

Moderators: arango, robertson

Post Reply
Message
Author
maxblu33
Posts: 22
Joined: Wed Sep 30, 2015 8:21 pm
Location: Institute of Oceanology of Cuba

inverted mask

#1 Post by maxblu33 » Fri Apr 21, 2017 9:00 pm

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 4755 times

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

Re: inverted mask

#2 Post by kate » Fri Apr 21, 2017 9:18 pm

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.

maxblu33
Posts: 22
Joined: Wed Sep 30, 2015 8:21 pm
Location: Institute of Oceanology of Cuba

Re: inverted mask

#3 Post by maxblu33 » Fri Apr 21, 2017 9:34 pm

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

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

Re: inverted mask

#4 Post by kate » Fri Apr 21, 2017 9:50 pm

Weird, the HYCOM tab in my browser points to http://tds.hycom.org/thredds/dodsC/data ... talog.html which now gives an error. Obviously it was working earlier this year. Anyone know where to look for it now?

johan.navarro.padron
Posts: 7
Joined: Mon Dec 05, 2011 3:29 pm
Location: Instituto de oceanolodia(IDO)

Re: inverted mask

#5 Post by johan.navarro.padron » Mon Apr 24, 2017 6:12 pm

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)

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

Re: inverted mask

#6 Post by kate » Mon Apr 24, 2017 6:25 pm

Cool, thanks!

petalas
Posts: 12
Joined: Mon Jul 04, 2016 1:31 pm
Location: University of the Aegean, GR

Re: inverted mask

#7 Post by petalas » Wed Apr 26, 2017 11:11 am

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: Select all

map = Basemap(projection='merc',resolution='i')
In this way pygridgen gets all the topological information of where land stops.

Stamatis

Vera
Posts: 15
Joined: Wed Apr 26, 2017 5:23 pm
Location: Sun Yat-sen University

Re: inverted mask

#8 Post by Vera » Fri May 26, 2017 3:16 am

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/data ... _00_3zs.nc. However, when I use the same script to download data today,it gives me the message:

Code: Select all

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.

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

Re: inverted mask

#9 Post by kate » Fri May 26, 2017 4:25 am

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?

Vera
Posts: 15
Joined: Wed Apr 26, 2017 5:23 pm
Location: Sun Yat-sen University

Re: inverted mask

#10 Post by Vera » Fri May 26, 2017 5:28 am

Ok,thank you.

Post Reply